From: Christopher Lenz Date: Wed, 22 Aug 2007 09:33:47 +0000 (+0000) Subject: Default the encoding of output by the `pybabel --list-locales` command to ASCII with... X-Git-Tag: 1.0~386 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5eb729cc7c90bcb16bb30b8ed9f65de6bf2c37fc;p=thirdparty%2Fbabel.git Default the encoding of output by the `pybabel --list-locales` command to ASCII with errors replaced, if the output stream has no encoding set. For a reason unknown to me I got an encoding error, but only when when running the output through a pipe on the shell. --- diff --git a/babel/messages/frontend.py b/babel/messages/frontend.py index deff17d6..60a841c3 100755 --- a/babel/messages/frontend.py +++ b/babel/messages/frontend.py @@ -631,7 +631,8 @@ class CommandLineInterface(object): format = u'%%-%ds %%s' % (longest + 1) for identifier in localedata.list(): locale = Locale.parse(identifier) - print format % (identifier, locale.english_name) + output = format % (identifier, locale.english_name) + print output.encode(sys.stdout.encoding or 'ascii', 'replace') return 0 if not args: