From 3eb211b442f95bb89eb97b3d0b3d7b90f7823c19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Borgstr=C3=B6m?= Date: Fri, 1 Jul 2011 21:53:38 +0200 Subject: [PATCH] Default to 'utf-8' as stderr and stdout encoding --- darc/archiver.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/darc/archiver.py b/darc/archiver.py index b11e459d3..a0ee34246 100644 --- a/darc/archiver.py +++ b/darc/archiver.py @@ -27,7 +27,7 @@ def open_store(self, location, create=False): def print_error(self, msg, *args): msg = args and msg % args or msg if hasattr(sys.stderr, 'encoding'): - msg = msg.encode(sys.stderr.encoding, 'ignore') + msg = msg.encode(sys.stderr.encoding or 'utf-8', 'ignore') self.exit_code = 1 print >> sys.stderr, msg @@ -35,7 +35,7 @@ def print_verbose(self, msg, *args, **kw): if self.verbose: msg = args and msg % args or msg if hasattr(sys.stdout, 'encoding'): - msg = msg.encode(sys.stdout.encoding, 'ignore') + msg = msg.encode(sys.stdout.encoding or 'utf-8', 'ignore') if kw.get('newline', True): print msg else: