Unicode with accents raising a UnicodeDecodeError upon registration (App Engine)

I'm trying to make changes to an old appengine application, but now, after creating my computer and installing updated tools, the logging functions raise an unicode error.

In the previous development environment, everything worked fine. ubuntu 9.04 python2.6 google appengine sdk 1.5

Now I'm trying to make changes to this environment: ubuntu 11.10 python2.7 google appengine sdk 1.6

In this new development environment, I get errors using logging functions.

logging.info(u'Gerando lista de exibição') # error 

Error:

'ascii' codec cannot decode byte 0xc3 at position 22: serial number is not in the range (128) args = ('ascii', 'Gerando lista de exibi \ xc3 \ xa7 \ xc3 \ xa3o', 22, 23, 'serial number not in range (128) ') encoding =' ascii 'end = 23 message =' 'object =' Gerando lista de exibi \ xc3 \ xa7 \ xc3 \ xa3o ... 'reason =' serial number not in range (128) 'start = 22

To work, I need to remove the accents:

logging.info (u'Gerando lista de exibicao ') # ok

My editor is utf-8, and all my scripts have "encoding: utf-8" as the first line.

Is this a problem with the version? Got some settings?

+6
source share
3 answers

This is mistake:

http://code.google.com/p/googleappengine/issues/detail?id=6266

I hope it will be fixed in the next version (1.6.1).

+3
source

You can check this page for unicode and utf-8 . Strategies and workarounds are also included. This is a known issue since Python 2's default encoding is "ascii".

0
source

Python 2 by default does not use UTF-8 for source code, otherwise you will need to specify the encoding. See PEP-263

 #!/usr/local/bin/python # -*- coding: utf-8 -*- 

In any case, it is not recommended to store Unicode in the source code.

-1
source

Source: https://habr.com/ru/post/901361/


All Articles