summaryrefslogtreecommitdiffstats
path: root/pykolab
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2015-05-21 17:42:43 +0200
committerThomas Bruederli <bruederli@kolabsys.com>2015-05-21 17:42:43 +0200
commit0c072d69d677fa7cdad65af563994f6a0098003f (patch)
tree274243414d512435d53c5b93a651f46c78cd1cb3 /pykolab
parent6122ee76c19970d950f0b4839e7fd46c89ed5421 (diff)
downloadpykolab-0c072d69d677fa7cdad65af563994f6a0098003f.tar.gz
Make locale encoding the default sys encoding; resolves T249
Diffstat (limited to 'pykolab')
-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)