推荐学习书目
› 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
a2z
V2EX  ›  Python

shift_jis 如何完美转换成 utf8?

  •  
  •   a2z · Feb 18, 2015 · 9418 views
    This topic created in 4275 days ago, the information mentioned may be changed or developed.
    用了codec.encode和codec.decode


    title='無料出会いサイト調査ファイル[地域別・セックス・逆援助・SMなどの攻略情報]'
    title=codecs.decode(title,charset,'replace')
    title=codecs.encode(title,"utf8","replace")

    無料出会いサイト調査ファイル[地域別・セックス・逆援助・SMなどの攻略情報]

    至少终端里看起来片假名全变成方块……
    16 replies  •  2016-06-22 20:02:16 +08:00
    ehs2013
    ehs2013
    Feb 18, 2015
    1
    终端的字体很有可能不带半角片假名字体。
    建议输出到文本进入专业文本编辑器中查看。
    rikeinei
    rikeinei
    Feb 18, 2015
    2
    if getEncoding(resultSF) == "shift-jis":
    resultSF = resultSF.decode('shift-jis').encode('utf-8')
    if getEncoding(resultSF) == "euc-jp":
    resultSF = resultSF.decode('euc-jp').encode('utf-8')
    loading
    loading
    Feb 18, 2015 via Android
    3
    @ehs2013 指了一条明路,楼主,冲吧。
    rikeinei
    rikeinei
    Feb 18, 2015
    4
    @a2z 楼主做啥工作的? 这个title的内容有点......
    a2z
    a2z
    OP
    Feb 18, 2015
    5
    @rikeinei
    爬虫相关……这个title是碰巧……
    rikeinei
    rikeinei
    Feb 18, 2015
    6
    @a2z 楼主,快说,报警了!风俗相关产业的从业人员?还是???
    a2z
    a2z
    OP
    Feb 18, 2015
    7
    @rikeinei
    搜索引擎相关,有些日语的title显示出来编码不对……我随便挑了一个看着眼熟的(逃
    rikeinei
    rikeinei
    Feb 18, 2015
    8
    @a2z 嘿嘿,想像一下啊,边看某网站,边写代码,结果随手拷贝一段文字用来做测试,恰好是。。。
    哈哈哈
    a2z
    a2z
    OP
    Feb 18, 2015
    9
    @rikeinei
    人坚不拆……
    la0wei
    la0wei
    Feb 18, 2015 via Android
    10
    @rikeinei 我觉着楼主是做国外H站的,我记得有个站可以根据番号看封面......暴露了
    jwk345
    jwk345
    Feb 18, 2015
    11
    大年三十的还在折腾
    imn1
    imn1
    Feb 18, 2015
    12
    终端只是字体问题,你终端使用的字体不支持半角片假字符
    rikeinei
    rikeinei
    Feb 18, 2015
    13
    @la0wei 看标题应该不是你说的那个网站,你要想看,sod,dmm随便看了
    orancho
    orancho
    Feb 18, 2015
    14
    楼主爬的是什么网站, sm圆月抛都出来了
    wdlth
    wdlth
    Feb 19, 2015
    15
    逆援助……这不是找牛郎么……
    xiaotaoqi
    xiaotaoqi
    Jun 22, 2016
    16
    数据处理,加我 QQ574632347 ,一起交流一下。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1308 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 21:01 · PVG 05:01 · LAX 13:01 · JFK 16:01
    ♥ Do have faith in what you're doing.