summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pykolab/cli/__init__.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/pykolab/cli/__init__.py b/pykolab/cli/__init__.py
index 56f121b..4843aba 100644
--- a/pykolab/cli/__init__.py
+++ b/pykolab/cli/__init__.py
@@ -63,6 +63,10 @@ class Cli(object):
for cmd_component in to_execute:
sys.argv.pop(sys.argv.index(cmd_component.replace('_','-')))
+ # force default encoding to match the locale encoding (T249)
+ reload(sys)
+ sys.setdefaultencoding(locale.getpreferredencoding() or 'utf-8')
+
# wrap sys.stdout in a locale-aware StreamWriter (#3983)
sys.stdout = codecs.getwriter(locale.getpreferredencoding())(sys.stdout)