# HG changeset patch # User cmlenz # Date 1187775227 0 # Node ID 385083341519525e55684dc2ee60b909f0083f71 # Parent 7d9c0bd217504adff4105fb390ff5940e9468cee 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 --- a/babel/messages/frontend.py +++ b/babel/messages/frontend.py @@ -631,7 +631,8 @@ 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: