# HG changeset patch # User Martin Geisler # Date 2009-08-05 22:26:34 # Node ID 8982eb292cb5adf3ddbed3bb9a16816f273fb259 # Parent 93a8be83ec09d808c77719abbf0de472f2eb84a8 i18n: updated outdated comment diff --git a/mercurial/i18n.py b/mercurial/i18n.py --- a/mercurial/i18n.py +++ b/mercurial/i18n.py @@ -36,9 +36,12 @@ def gettext(message): if message is None: return message - # We cannot just run the text through encoding.tolocal since that - # leads to infinite recursion when encoding._encoding is invalid. try: + # encoding.tolocal cannot be used since it will first try to + # decode the Unicode string. Calling u.decode(enc) really + # means u.encode(sys.getdefaultencoding()).decode(enc). Since + # the Python encoding defaults to 'ascii', this fails if the + # translated string use non-ASCII characters. u = t.ugettext(message) return u.encode(encoding.encoding, "replace") except LookupError: