diff options
author | Thomas Bruederli <bruederli@kolabsys.com> | 2015-05-21 17:42:43 +0200 |
---|---|---|
committer | Thomas Bruederli <bruederli@kolabsys.com> | 2015-05-21 17:42:43 +0200 |
commit | 0c072d69d677fa7cdad65af563994f6a0098003f (patch) | |
tree | 274243414d512435d53c5b93a651f46c78cd1cb3 /pykolab/cli | |
parent | 6122ee76c19970d950f0b4839e7fd46c89ed5421 (diff) | |
download | pykolab-0c072d69d677fa7cdad65af563994f6a0098003f.tar.gz |
Make locale encoding the default sys encoding; resolves T249
Diffstat (limited to 'pykolab/cli')
-rw-r--r-- | pykolab/cli/__init__.py | 4 |
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) |