推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
secsilm
V2EX  ›  Python

大佬们求解码一个未知编码的字符串

  •  
  •   secsilm ·
    secsilm · Apr 4, 2018 · 3337 views
    This topic created in 2986 days ago, the information mentioned may be changed or developed.

    字符串:'0101.┐╔░«┼«╚╦.mp3'

    搞了半天,没弄成,实际上中间是中文

    7 replies    2018-05-03 10:48:54 +08:00
    scriptB0y
        1
    scriptB0y  
       Apr 4, 2018
    贴个二进制编码的看看
    dassh
        2
    dassh  
       Apr 4, 2018   ❤️ 9
    知道中文就简单啦,遍历所有编码即可
    https://imgur.com/YCPKD04
    secsilm
        3
    secsilm  
    OP
       Apr 4, 2018 via Android
    感谢各位回复,发帖之后又查了一下终于发现就是 cp437 编码😂,二楼厉害,我回去看看这个库
    yazoox
        4
    yazoox  
       Apr 4, 2018
    @dassh 顶!
    secsilm
        5
    secsilm  
    OP
       Apr 4, 2018   ❤️ 1
    FYI,[Standard Encodings]( https://docs.python.org/3.6/library/codecs.html#standard-encodings) 列出了所有的 codecs,比 @dassh 所使用的 `encodings.aliases.aliases` 多了几个没有别名的,而且还有对应的常用的语言。

    ![]( )
    secsilm
        6
    secsilm  
    OP
       May 2, 2018
    @dassh 大佬,发现一个用你的方法也编不出来的字符串:`08.����ű�`
    dassh
        7
    dassh  
       May 3, 2018
    @secsilm 因为你发的这个已经软件 /浏览器不识别而替换掉了,参见 wikipedia
    https://en.wikipedia.org/wiki/Specials_(Unicode_block)
    � REPLACEMENT CHARACTER used to replace an unknown, unrecognized or unrepresentable character
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3608 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 43ms · UTC 04:56 · PVG 12:56 · LAX 21:56 · JFK 00:56
    ♥ Do have faith in what you're doing.