Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnicodeDecodeError #136

Closed
wenshan-willowit opened this issue Jul 8, 2013 · 2 comments
Closed

UnicodeDecodeError #136

wenshan-willowit opened this issue Jul 8, 2013 · 2 comments

Comments

@wenshan-willowit
Copy link

Hi,

I'm trying to log some information using the kivy Logger, here is the code:

sql = "insert or replace into res_partner (name) values " + values
Logger.info(sql)

(values is a string).

When I run the program on Android, I got:

I/python  ( 4319):  Logged from file main.py, line 46
I/python  ( 4319):  Traceback (most recent call last):
I/python  ( 4319):    File "/home/openerp/code/python-for-android/build/python-install/lib/python2.7/logging/__init__.py", line 865, in emit
I/python  ( 4319):    File "<string>", line 15, in write
I/python  ( 4319):  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 759: ordinal not in range(128)

On Ubuntu, I got the expected result:

[INFO   ] insert or replace into res_partner (name) values ("Administrator"),("Wenshan"),("Your Company")

Any idea on this?

@mplzgta
Copy link

mplzgta commented Jul 10, 2013

Not sure what the "correct" solution for this is, but after generating my distribution and before building my .apk I put the following in sitecustomize.py in lib/site-packages/ and it fixed the problem:

import sys
sys.setdefaultencoding('utf-8')

@FeralBytes
Copy link
Contributor

Yes you would have to use a UTF-8 codec to decode the data especially on Android. Recommend this gets closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants