[Python-Dev] Re: gettext in the standard library (original) (raw)
M.-A. Lemburg mal@lemburg.com
Mon, 21 Aug 2000 11:30:20 +0200
- Previous message: [Python-Dev] Re: gettext in the standard library
- Next message: [Python-Dev] Re: gettext in the standard library
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Martin von Loewis wrote:
> Hmm, if your catalogs are encoded in UTF-8 and use non-ASCII > chars then the traditional API would have to raise encoding > errors I don't know what you mean by "traditional" here. The gettext.gettext implementation in Barry's patch will return the UTF-8 encoded byte string, instead of raising encoding errors - no code conversion takes place.
True.
> Perhaps the return value type of .gettext() should be given on > the .install() call: e.g. encoding='utf-8' would have .gettext() > return a string using UTF-8 while encoding='unicode' would have > it return Unicode objects.
No. You should have the option of either receiving byte strings, or Unicode strings. If you want byte strings, you should get the ones appearing in the catalog.
So you're all for the two different API version ? After some more thinking, I think I agree. The reason is that the lookup itself will have to be Unicode-aware too:
gettext.unigettext(u"L�schen") would have to convert u"L�schen" to UTF-8, then look this up and convert the returned value back to Unicode.
gettext.gettext(u"L�schen") will fail with ASCII default encoding.
-- Marc-Andre Lemburg
Business: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/
- Previous message: [Python-Dev] Re: gettext in the standard library
- Next message: [Python-Dev] Re: gettext in the standard library
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]