【问题标题】:Pygame Subset for Android and utf-16-be encoding适用于 Android 和 utf-16-be 编码的 Pygame 子集
【发布时间】: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

标签: python android pygame


【解决方案1】:

您也许可以将'\x'chr() 用于奇怪的字符。

chr(83)='S'='\x53'
ord('S')=83

chrord 都内置在 python 函数中。

一旦找到这些奇数字符的数字,它可能会起作用。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-02-25
    • 1970-01-01
    • 2012-03-13
    • 2020-08-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-10
    相关资源
    最近更新 更多