changeset 267:385083341519 trunk

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.
author cmlenz
date Wed, 22 Aug 2007 09:33:47 +0000
parents 7d9c0bd21750
children 84d2414021d9
files babel/messages/frontend.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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:
Copyright (C) 2012-2017 Edgewall Software