I'm playing with RenPy's pygame for android and I encountered problem with unicode...
Even this simple script crashes:
#-*- coding: utf-8 -*-
blah = u"żźć"
def main():
pass
Here's what adb logcat is telling me:
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
I know that it simply doesn't have this encoding, but why does it try to use utf-16-be at all? I'm saving it as utf-8 (using gean开发者_开发技巧y). Sorry, my English isn’t very good ><. Thanks in advance.
You might be able to use '\x'
and chr()
for weird characters.
chr(83)='S'='\x53'
ord('S')=83
Both chr and ord are built in python functions.
Once you find the number for those odd characters it might work.
精彩评论