summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pykolab/cli/__init__.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/pykolab/cli/__init__.py b/pykolab/cli/__init__.py
index e6ccf0c..56f121b 100644
--- a/pykolab/cli/__init__.py
+++ b/pykolab/cli/__init__.py
@@ -24,6 +24,8 @@ import traceback
import shutil
import sys
import time
+import codecs
+import locale
from ldap.modlist import addModlist
@@ -61,6 +63,9 @@ class Cli(object):
for cmd_component in to_execute:
sys.argv.pop(sys.argv.index(cmd_component.replace('_','-')))
+ # wrap sys.stdout in a locale-aware StreamWriter (#3983)
+ sys.stdout = codecs.getwriter(locale.getpreferredencoding())(sys.stdout)
+
commands.execute('_'.join(to_execute))
def run(self):