[Tutor] Encode problem

spir denis.spir at free.fr
Mon May 4 21:26:30 CEST 2009


Le Mon, 4 May 2009 11:09:25 -0300,
"Pablo P. F. de Faria" <pablofaria at gmail.com> s'exprima ainsi:

> Thanks, Kent, but that doesn't solve my problem. In fact, I need
> ConfigParser to work with non-ascii characters, since my App may run
> in "latin-1" environments (folders e files names). I must find out why
> the str() function in the module ConfigParser doesn't use the encoding
> defined for the application (# -*- coding: utf-8 -*-). The rest of the
> application works properly with utf-8, except for ConfigParser. What I
> found out is that ConfigParser seems to make use of the configuration
> in Site.py (which is set to 'ascii'), instead of the configuration
> defined for the App (if I change . But this is very problematic to
> have to change Site.py in every computer... So I wonder if there is a
> way to replace the settings in Site.py only for my App.


The parameter in question is the default encoding. We used to read (sys.getdefaultencoding()) and define it (e.g. sys.getdefaultencoding('utf8')), but I remember something has changed in later versions of python.
Someone?

Denis
------
la vita e estrany


More information about the Tutor mailing list