[ctl] set proper encoding for sys.stdout/sys.stderr. Closes #1669144
--- a/cwctl.py Thu Sep 19 22:33:52 2013 +0200
+++ b/cwctl.py Thu Sep 26 10:46:37 2013 +0200
@@ -1055,8 +1055,13 @@
def run(args):
"""command line tool"""
import os
+ import codecs
+ encoding = sys.stdout.encoding
sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
+ sys.stdout = codecs.getwriter(encoding)(sys.stdout)
+ encoding = sys.stderr.encoding
sys.stderr = os.fdopen(sys.stderr.fileno(), 'w', 0)
+ sys.stderr = codecs.getwriter(encoding)(sys.stderr)
cwcfg.load_cwctl_plugins()
try:
CWCTL.run(args)