[Patches] [ python-Patches-568669 ] gettext module charset changes

noreply@sourceforge.net noreply@sourceforge.net
Thu, 13 Jun 2002 13:13:57 -0700


Patches item #568669, was opened at 2002-06-13 16:13
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=568669&group_id=5470

Category: Library (Lib)
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Barry A. Warsaw (bwarsaw)
Assigned to: Martin v. Löwis (loewis)
Summary: gettext module charset changes

Initial Comment:
The GNU gettext docs make two recommendations: that the
source string to gettext() be in us-ascii, and that the
default output charset be in the locale's character
set.  I think the latter makes the most sense for our
ugettext() methods.

The attached patch sets the default character set to
us-ascii for NullTranslations.  For GNUTranslations,
the default character set is taken from the
Content-Type: header if given in the .po/.mo file,
otherwise it's taken from the default locale
information, if available.  It falls back to the base
class charset (by default us-ascii).

This patch also provides the following:

- add a set_charset() method to the NullTranslations
base class, so that it is easier to change the default
character set.  For symmetry, I also rename charset()
to get_charset() and keep the former for backwards
compatibility.

- convert Lib/test/test_gettext.py to unittest style
(sans the cvs rm of Lib/test/output/test_gettext which
we'll do separately)

- update the docs for all the code changes described above.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=568669&group_id=5470