use utf-8 instead of ascii as default output encoding
authorAlexander Solovyov <piranha@piranha.org.ua>
Tue, 02 Nov 2010 13:26:42 +0100
changeset 128 cd818293ed93
parent 127 67a0ead9bb59
child 129 a95e20a55663
use utf-8 instead of ascii as default output encoding
opster.py
runtests
--- a/opster.py	Mon Nov 01 17:44:08 2010 +0100
+++ b/opster.py	Tue Nov 02 13:26:42 2010 +0100
@@ -13,15 +13,14 @@
 try:
     import locale
     ENCODING = locale.getpreferredencoding()
-    if not ENCODING or ENCODING == 'mac-roman':
-        ENCODING = 'utf-8'
+    if not ENCODING or ENCODING == 'mac-roman' or 'ascii' in ENCODING.lower():
+        ENCODING = 'UTF-8'
 except locale.Error:
-    ENCODING = 'utf-8'
+    ENCODING = 'UTF-8'
 
 def write(text, out=sys.stdout):
-    encoding = locale.getpreferredencoding()
     if isinstance(text, unicode):
-        return out.write(text.encode(encoding))
+        return out.write(text.encode(ENCODING))
     out.write(text)
 
 def err(text):
--- a/runtests	Mon Nov 01 17:44:08 2010 +0100
+++ b/runtests	Tue Nov 02 13:26:42 2010 +0100
@@ -1,4 +1,4 @@
 #!/bin/sh
 
 cd tests
-cram -E *
+cram *