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

2015-02-24 12:48:09 +08:00
 life
页面显示出错信息如下:

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)

万谢!
10944 次点击
所在节点    Project Babel
3 条回复
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
2015-02-24 15:15:03 +08:00
这简直是上古巨坟了 在报错的地方 encode 一下就好了 以前我遇到过
life
2015-02-26 17:01:21 +08:00
@ss098
@mimzy
已解决。感谢!

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/172453

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX