Show More
@@ -36,9 +36,12 b' def gettext(message):' | |||
|
36 | 36 | if message is None: |
|
37 | 37 | return message |
|
38 | 38 | |
|
39 | # We cannot just run the text through encoding.tolocal since that | |
|
40 | # leads to infinite recursion when encoding._encoding is invalid. | |
|
41 | 39 | try: |
|
40 | # encoding.tolocal cannot be used since it will first try to | |
|
41 | # decode the Unicode string. Calling u.decode(enc) really | |
|
42 | # means u.encode(sys.getdefaultencoding()).decode(enc). Since | |
|
43 | # the Python encoding defaults to 'ascii', this fails if the | |
|
44 | # translated string use non-ASCII characters. | |
|
42 | 45 | u = t.ugettext(message) |
|
43 | 46 | return u.encode(encoding.encoding, "replace") |
|
44 | 47 | except LookupError: |
General Comments 0
You need to be logged in to leave comments.
Login now