[Python-Dev] Internationalization Toolkit

M.-A. Lemburg mal@lemburg.com
Thu, 11 Nov 1999 14:01:40 +0100


Mark Hammond wrote:
> 
> Marc writes:
> 
> > > modes are evil.  python is not perl.  etc.
> >
> > But a requirement by the customer... they want to be able to
> > set the locale
> > on a per thread basis. Not exactly my preference (I think all locale
> > settings should be passed as parameters, not via globals).
> 
> Sure - that is what this customer wants, but we need to be clear about
> the "best thing" for Python generally versus what this particular
> client wants.
> 
> For example, if we went with UTF-8 as the only default encoding, then
> HP may be forced to use a helper function to perform the conversion,
> rather than the built-in functions.  This helper function can use TLS
> (in Python) to store the encoding.  At least it is localized.
> 
> I agree that having a default encoding that can be changed is a bad
> idea.  It may make 3 line scripts that need to print something easier
> to work with, but at the cost of reliability in large systems.  Kinda
> like the existing "locale" support, which is thread specific, and is
> well known to cause these sorts of problems.  The end result is that
> in your app, you find _someone_ has changed the default encoding, and
> some code no longer works.  So the solution is to change the default
> encoding back, so _your_ code works again.  You just know that whoever
> it was that changed the default encoding in the first place is now
> going to break - but what else can you do?
> 
> Having a fixed, default encoding may make life slightly more difficult
> when you want to work primarily in a different encoding, but at least
> your system is predictable and reliable.

I think the discussion on this is getting a little too hot. The point
is simply that the option of changing the per-thread default encoding
is there. You are not required to use it and if you do you are on
your own when something breaks.

Think of it as a HP specific feature... perhaps I should wrap the code
in #ifdefs and leave it undocumented.

-- 
Marc-Andre Lemburg
______________________________________________________________________
Y2000:                                                    50 days left
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/