V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
life
V2EX  ›  Project Babel

PB2[2.5.0-dev-7]:"站点名"使用中文的话点击"浏览全部节点"会出错,请问该如何修正?

  •  
  •   life · 2015-02-24 12:48:09 +08:00 · 10879 次点击
    这是一个创建于 3320 天前的主题,其中的信息可能已经有所发展或是发生改变。
    页面显示出错信息如下:

    Traceback (most recent call last):
    File "/base/data/home/runtimes/python/python_lib/versions/1/google/appengine/ext/webapp/_webapp25.py", line 715, in __call__
    handler.get(*groups)
    File "/base/data/home/apps/s~gaecnv2ex/1.382454029817673204/main.py", line 228, in get
    self.values['page_title'] = self.site.title.decode('utf-8') + u' › ' + self.l10n.planes.decode('utf-8')
    File "/base/data/home/runtimes/python/python_dist/lib/python2.5/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
    UnicodeEncodeError: 'ascii' codec can't encode characters in position 7-8: ordinal not in range(128)

    万谢!
    3 条回复    2015-02-26 17:01:21 +08:00
    ss098
        1
    ss098  
       2015-02-24 12:55:12 +08:00
    这是一个编码方面的问题,可以通过 Python 字符串的 encode 方法处理。

    http://www.baidu.com/s?ie=UTF-8&wd=python+%E7%BC%96%E7%A0%81
    mimzy
        2
    mimzy  
       2015-02-24 15:15:03 +08:00
    这简直是上古巨坟了 在报错的地方 encode 一下就好了 以前我遇到过
    life
        3
    life  
    OP
       2015-02-26 17:01:21 +08:00 via Android
    @ss098
    @mimzy
    已解决。感谢!
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1002 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 20:03 · PVG 04:03 · LAX 13:03 · JFK 16:03
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.