A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-April/044573.html below:

[Python-Dev] Small issues in gettext support

[Python-Dev] Small issues in gettext support [Python-Dev] Small issues in gettext supportGustavo Niemeyer niemeyer at conectiva.com
Mon Apr 26 11:33:03 EDT 2004
> > 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

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4