Help : looking for language -> best encoding scheme dict.
David Necas (Yeti)
yeti at physics.muni.cz
Tue Dec 10 14:01:59 EST 2002
On Tue, Dec 10, 2002 at 07:43:58PM +0100, Martin v. Löwis wrote:
> > Has someone already got a dictionnary (or tuple of tuples) that
> associate
> > the ISO language codes to the prefered encoding scheme for that
> language (as
> > expected by "unicodestring.encode(...)" ).
>
> Mailman 2.1 has a (limited) collection of such information, in a
> dictionary.
>
> If you find a locale.aliases file on Unix, checking the aliases will
> tell you what the system developers think that the defaults should be.
locale.aliases is usually highly incomplete, and
I'm afraid system having locale.aliases will have
nl_langinfo() too, so you can do
import locale
oldlocale = locale.setlocale(locale.LC_CTYPE)
codeset = locale.nl_langinfo(locale.CODESET)
locale.setlocale(locale.LC_CTYPE, oldlocale)
to find out the codeset.
Yeti
More information about the Python-list
mailing list