[Python-ideas] RFC: PEP 540 version 3 (Add a new UTF-8 mode)

Oleg Broytman phd at phdru.name
Thu Jan 12 13:13:40 EST 2017


On Thu, Jan 12, 2017 at 01:04:43PM -0500, Random832 <random832 at fastmail.com> wrote:
> On Thu, Jan 12, 2017, at 12:10, Victor Stinner wrote:
> > 2017-01-12 17:10 GMT+01:00 Oleg Broytman <phd at phdru.name>:
> > >> Does it work to use a locale with encoding A for LC_CTYPE and a locale
> > >> with encoding B for LC_MESSAGES (and others)? Is there a risk of
> > >
> > >    It does when B is a subset of A (ascii and koi8; ascii and utf8, e.g.)
> > 
> > My question is more when A and B encodings are not compatible.
> > 
> > Ah yes, date, thank you for the example. Here is my example using
> > LC_TIME locale to format a date and LC_CTYPE to decode a byte string:
> 
> Time and messages seem to behave differently - everything I tested
> (including python 2 os.strerror) seems to ignore the LC_MESSAGES
> encoding and use the LC_CTYPE encoding, including resulting in a bunch
> of question marks when it's "C".

   Works for me as expected:

$ echo $LC_CTYPE
ru_RU.KOI8-R

$ LC_MESSAGES=ru_RU.KOI8-R mc

   mc speaks to me in Russian...

$ LC_MESSAGES=C mc

   ...English.

Oleg.
-- 
     Oleg Broytman            http://phdru.name/            phd at phdru.name
           Programmers don't die, they just GOSUB without RETURN.


More information about the Python-ideas mailing list