Skip to content Skip to sidebar Skip to footer

Missing Unicode Codecs On Kivy/Python On Android?

I have a program running under kivy that works fine on Windows but fails on opening a file on Android (1.8.0 on both platforms). The odd thing is that the error message indicates i

Solution 1:

Get rid of the try/except and look at the real exception. codecs.BOM is a byte string \xff\xfe and it is being coerced into Unicode using the default ascii codec:

>>> import codecs
>>> codecs.BOM
'\xff\xfe'
>>> u'test'.lstrip(codecs.BOM)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeDecodeError: 'ascii' codec can't decode byte 0xff in position 0: ordinal not in range(128)

Post a Comment for "Missing Unicode Codecs On Kivy/Python On Android?"