Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
dinggk
V2EX  ›  Linux

Linux 下 Python 怎样转换 Wifi 中文名称

  •  
  •   dinggk · Apr 13, 2018 · 4626 views
    This topic created in 2958 days ago, the information mentioned may be changed or developed.

    linux 扫描 wifi,如果名称是中文,得到的内容是十六进制编码的,请教如何转换为 utf8 中文字符? 大家知道这些中文名称都可能是那些编码? GBK ? GB2312 ? UTF16 ( LE?BE?)?

    6 replies    2018-04-13 18:42:17 +08:00
    liuxu
        1
    liuxu  
       Apr 13, 2018
    wicd 你值得拥有
    chinvo
        2
    chinvo  
       Apr 13, 2018
    大部分是 UTF8 的,部分国产设备是 GBK

    iOS 和 Mac 上会乱码的是 GBK
    ashfinal
        3
    ashfinal  
       Apr 13, 2018 via iPhone
    In [39]: s = b'\xE7\x8E\x9B\xE7\x8E\x9B\xE5\x93\x88\xE5\x93\x88'

    In [40]: print(s.decode('gbk'))
    鐜涚帥鍝堝搱

    In [41]: s.decode('utf8')
    Out[41]: '玛玛哈哈'
    Hopetree
        4
    Hopetree  
       Apr 13, 2018
    @ashfinal 娜可露露????妙啊
    ashfinal
        5
    ashfinal  
       Apr 13, 2018 via iPhone
    @Hopetree What are you talking about?
    860670496
        6
    860670496  
       Apr 13, 2018
    @ashfinal #5 侍魂里那可露露的鹰叫做玛玛哈哈
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5316 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 47ms · UTC 07:35 · PVG 15:35 · LAX 00:35 · JFK 03:35
    ♥ Do have faith in what you're doing.