Mercurial > babel > old > babel-test
diff babel/messages/pofile.py @ 149:ba5150e9544e
Respect charset specified in PO headers in `read_po()`. Fixes #17.
author | cmlenz |
---|---|
date | Wed, 20 Jun 2007 20:31:24 +0000 |
parents | 60565dc8495d |
children | 17dd31f104f5 |
line wrap: on
line diff
--- a/babel/messages/pofile.py +++ b/babel/messages/pofile.py @@ -60,12 +60,12 @@ ... print (message.id, message.string) ... print ' ', (message.locations, message.flags) ... print ' ', (message.user_comments, message.auto_comments) - ('foo %(name)s', '') - ([('main.py', 1)], set(['fuzzy', 'python-format'])) + (u'foo %(name)s', '') + ([(u'main.py', 1)], set([u'fuzzy', u'python-format'])) ([], []) - (('bar', 'baz'), ('', '')) - ([('main.py', 3)], set([])) - (['A user comment'], ['An auto comment']) + ((u'bar', u'baz'), ('', '')) + ([(u'main.py', 3)], set([])) + ([u'A user comment'], [u'An auto comment']) :param fileobj: the file-like object to read the PO file from :return: an iterator over ``(message, translation, location)`` tuples @@ -97,7 +97,7 @@ del flags[:]; del auto_comments[:]; del user_comments[:] for line in fileobj.readlines(): - line = line.strip() + line = line.strip().decode(catalog.charset) if line.startswith('#'): in_msgid = in_msgstr = False if messages: