[Python-Dev] Small issues in gettext support (original) (raw)
Gustavo Niemeyer niemeyer at conectiva.com
Mon Apr 26 11:33:03 EDT 2004
- Previous message: [Python-Dev] Small issues in gettext support
- Next message: [Python-Dev] Small issues in gettext support
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> opportunity for getting lots of UnicodeErrors? E.g. my system encoding > is 'ascii' so gettext() would fail for catalogs containing non-ascii > characters. I shouldn't have to change my system encoding just to avoid > errors, but with your suggestion, wouldn't that make many catalogs > basically unusable for me?
Another interesting point, from the gettext documentation:
"""
The output character set is, by default, the value of nl_langinfo (CODESET)', which depends on the
LC_CTYPE' part of the current locale.
But programs which store strings in a locale independent way (e.g.
UTF-8) can request that gettext' and related functions return the translation in that encoding, by use of the
bind_textdomain_codeset'
function.
"""
So, we should use some variant of locale.nl_langinfo(locale.CODESET) to get the default encoding. Since this should be changed together with the language used when 'setlocale' is issued, the UnicodeError problems you're afraid of would also go away.
-- Gustavo Niemeyer http://niemeyer.net
- Previous message: [Python-Dev] Small issues in gettext support
- Next message: [Python-Dev] Small issues in gettext support
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]