[Thuban-list] pt_pt error messages

Bernhard Herzog bh at intevation.de
Thu Jul 28 15:29:43 CEST 2005

"Serviopa" <serviopa at sili.com.br> writes:

> And the i18n file:
> $ less /etc/sysconfig/i18n
> LANGUAGE=pt_BR:pt_PT:pt

Is this also the value of your environment variable LANGUAGE?  If so,
that's the origin of the problem.  This looks like a bug in Python
(details below).  As a workaround, try

export LANGUAGE=pt_BR.ISO-8859-1:pt_PT:pt


The rest of this post are the details on the python bug.  Feel free to
skip it :)

The real problem behind all this is that there's no reliable way to
determine the encoding to use.  Python's locale module tries to deduce
it from the locale settings and on linux that means to deduce it from
the locale name.  To do this it looks at following environtment
variables in that order: 'LANGUAGE', 'LC_ALL', 'LC_CTYPE', 'LANG'

The value of the first of these variables which actually has a value is
then used to determine the encoding.  The value is "normalized" which
replaces ":" with "." among other things.  The normalized value of
"pt_BR:pt_PT:pt" is 'pt_BR.pt_pt'.  In the normalized value, the
encoding is assumed to be the text after a "@" or a ".", so in your case
that's "pt_pt", which is obviously incorrect.

The bug in Python is that it doesn't take into account that LANGUAGE can
be a colon-separated list of locales.  This appears to be present in the
current CVS version of Python as well.  If I find the time, I'll try to
make a least a bug report for it.


Intevation GmbH                                 http://intevation.de/
Skencil                                           http://skencil.org/
Thuban                                  http://thuban.intevation.org/

More information about the Thuban-list mailing list

This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)