Gustavo Niemeyer wrote: > # Encode the Unicode tmsg back to an 8-bit string, if possible > if self._charset: > return tmsg.encode(self._charset) > > to use the system encoding (sys.getdefaultencoding()) instead of > self._charset. That shouldn't be sys.getdefaultencoding(), but locale.getpreferredencoding(). However, I agree with Barry that the current behaviour should not be changed. People may already rely on gettext returning byte strings as-is. > - Change the default codeset used by gettext.py in functions > returning an encoded string to match the system encoding. No. Explicit is better that implicit; users desiring that feature should write _charset = locale.getpreferredencoding() def _(msg): return dgettext("domain", msg).encode(_charset) I advocate never to use gettext.install, in which case you have a custom _ implementation *anyway*, which would then also include the textual domain. It should not be too much effort for that function to transcode if desired. > - Introduce bind_textdomain_codeset() in locale. > - Introduce bind_textdomain_codeset() in gettext.py implementing > an equivalent functionality. That is ok. You could also try to provide that feature consistently, e.g. inside .install. Regards, Martin
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