VMM/cli: Avoid UnicodeDecodeErrors with some „obsolete“ encodings. v0.7.x
authorPascal Volk <user@localhost.localdomain.org>
Mon, 26 Nov 2012 19:04:38 +0000
branchv0.7.x
changeset 654 f2463a64e1d7
parent 653 cf07e4468934
child 655 2bf68600e914
VMM/cli: Avoid UnicodeDecodeErrors with some „obsolete“ encodings.
VirtualMailManager/cli/__init__.py
--- a/VirtualMailManager/cli/__init__.py	Sun Nov 25 17:06:17 2012 +0000
+++ b/VirtualMailManager/cli/__init__.py	Mon Nov 26 19:04:38 2012 +0000
@@ -31,7 +31,8 @@
     """Writes a line for each arg of *args*, encoded in the current
     ENCODING, to stdout.
     """
-    _std_write('\n'.join(arg.encode(ENCODING, 'replace').decode()
+    _std_write('\n'.join(arg.encode(ENCODING, 'replace').decode(ENCODING,
+                                                                'replace')
                for arg in args) + '\n')
 
 
@@ -41,7 +42,8 @@
     This function optionally interrupts the program execution if *code*
     does not equal to 0. *code* will be used as the system exit status.
     """
-    _err_write('\n'.join(arg.encode(ENCODING, 'replace').decode()
+    _err_write('\n'.join(arg.encode(ENCODING, 'replace').decode(ENCODING,
+                                                                'replace')
                for arg in args) + '\n')
     if code:
         os.sys.exit(code)