changeset 9319:8982eb292cb5

i18n: updated outdated comment
author Martin Geisler <mg@lazybytes.net>
date Thu, 06 Aug 2009 00:26:34 +0200
parents 93a8be83ec09
children 884964f99e07
files mercurial/i18n.py
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/i18n.py	Wed Aug 05 16:32:57 2009 +0200
+++ b/mercurial/i18n.py	Thu Aug 06 00:26:34 2009 +0200
@@ -36,9 +36,12 @@
     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: