platform default language and encoding

Radovan Garabik spam at melkor.dnp.fmph.uniba.sk
Wed Aug 21 04:52:26 EDT 2002


Gillou <nospam at bigfoot.com> wrote:
 : Hi,

 : I'm in process to make a localisable Zope product that guesses the server
 : preferences.
 : Using this with Python 2.1.3...

 :>>> import locale
 :>>> locale.getdefaultlocale()

 : --> Win32 : ('fr_FR', 'cp1252')
 : --> FreeeBSD : ('fr_FR', 'iso8859-1')

 : This is perfect for me but I heard that this does not always work and
 : sometimes returns an empty tuple.
 : What are the guru opinions about this ?

On Unix platforms, it returns current locale, which is usually
determined by environmental variables. That means it is user
responsibility to set it up (and different users on the system 
can have different locales). 
Rule number one: servers should not be locale dependent. Never.
Or in other words, they should work in UTF-8 locale, if 
you need special locale functions. And clients should be able to convert
the output into user locale, if necessary.
(however, without further information it is difficult to say
why you need locale functions and what is the best way)

-- 
 -----------------------------------------------------------
| Radovan Garabik  http://melkor.dnp.fmph.uniba.sk/~garabik |
| __..--^^^--..__         garabik @ fmph . uniba . sk       |
 -----------------------------------------------------------
Antivirus alert: file .signature infected by signature virus.
Hi! I'm a signature virus! Copy me into your signature file to help me spread!



More information about the Python-list mailing list