[Python-Dev] logging module broken because of locale

Guido van Rossum guido at python.org
Tue Jul 18 19:19:54 CEST 2006


Alternatively, does "info".upper() == "INFO" everywhere?

On 7/18/06, Mihai Ibanescu <misa at redhat.com> wrote:
> On Mon, Jul 17, 2006 at 03:39:55PM -0400, Mihai Ibanescu wrote:
> > Hi,
> >
> > This is reported on sourceforge:
> >
> > http://sourceforge.net/tracker/index.php?func=detail&aid=1524081&group_id=5470&atid=105470
> >
> > I am willing to try and patch the problem, but I'd like to discuss my ideas
> > first.
> >
> > The basic problem is that, in some locale, "INFO".lower() != "info". So,
> > initializing a dictionary with keys that appear to be lower-case in English
> > is unsafe for other locale.
> >
> > Now, the other problem is, people can choose to initialize the locale any time
> > they want, and can choose to change it too. My initial approach was to create
> > the dictionary with strings to which lower() was explicitly called.
> >
> > But, since priority_names is class-scoped, it gets evaluated at module import
> > time, which is way too early in the game (most likely the locale will be set
> > afterwards).
> >
> > Any thoughts on the proper way to approach this?
>
> To follow up on my own email: it looks like, even though in some locale
> "INFO".lower() != "info"
>
> u"INFO".lower() == "info" (at least in the Turkish locale).
>
> Is that guaranteed, at least for now (for the current versions of python)?
>
> Thanks,
> Misa
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/guido%40python.org
>


-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list