Commits

Anonymous committed 0ab0713

hachoir_core.i18n: Fix initLocale(), return the charset if it was already called once

  • Participants
  • Parent commits 174552b

Comments (0)

Files changed (1)

File hachoir-core/hachoir_core/i18n.py

 
 def initLocale():
     # Only initialize locale once
-    try:
-        if initLocale.is_done:
-            return
-    except AttributeError:
-        pass
+    if initLocale.is_done:
+        return getTerminalCharset()
     initLocale.is_done = True
 
     # Setup locales
         sys.stdout = UnicodeStdout(sys.stdout, charset)
         sys.stderr = UnicodeStdout(sys.stderr, charset)
     return charset
+initLocale.is_done = False
 
 def _dummy_gettext(text):
     return unicode(text)