Skip to content

Commit

Permalink
use utf-8 instead of ascii as default output encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Solovyov committed Nov 2, 2010
1 parent 05696d2 commit d79daeb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions opster.py
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion runtests
@@ -1,4 +1,4 @@
#!/bin/sh

cd tests
cram -E *
cram *

0 comments on commit d79daeb

Please sign in to comment.