【发布时间】:2011-01-23 14:29:13
【问题描述】:
我正在玩 RenPy 的 pygame for android,但遇到了 unicode 问题...
即使是这个简单的脚本也会崩溃:
#-*- coding: utf-8 -*-
blah = u"żźć"
def main():
pass
这是 adb logcat 告诉我的:
I/python ( 6957): Traceback (most recent call last):
I/python ( 6957): File "start.pyx", line 59, in init start (/home/tom/ab/pygame-droid/android-sdl/jni/../jni/application/src//start.c:1372)
I/python ( 6957): LookupError: unknown encoding: utf-16-be
我知道它根本没有这种编码,但它为什么要尝试使用 utf-16-be 呢?我将它保存为 utf-8(使用 geany)。对不起,我的英语不是很好>
【问题讨论】:
-
android不像linux那样使用unicode,他们采用了icu,你确定python构建支持unicode吗?如果您使用 utf8,则不需要 u'',只需将其分配给 blah