From: Felix Schwarz Date: Sat, 19 Mar 2011 19:50:21 +0000 (+0000) Subject: babel.messages.pofile should only apply encoding when actually writing a file (eases... X-Git-Tag: 1.0~198 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=05d1acbcbf42fbf8ad6b15980c7ceed948dce489;p=thirdparty%2Fbabel.git babel.messages.pofile should only apply encoding when actually writing a file (eases Python 3 transition, closes #251) --- diff --git a/babel/messages/pofile.py b/babel/messages/pofile.py index 3761e04e..5a0ef298 100644 --- a/babel/messages/pofile.py +++ b/babel/messages/pofile.py @@ -382,12 +382,11 @@ def write_po(fileobj, catalog, width=76, no_location=False, omit_header=False, updating the catalog """ def _normalize(key, prefix=''): - return normalize(key, prefix=prefix, width=width) \ - .encode(catalog.charset, 'backslashreplace') + return normalize(key, prefix=prefix, width=width) def _write(text): if isinstance(text, unicode): - text = text.encode(catalog.charset) + text = text.encode(catalog.charset, 'backslashreplace') fileobj.write(text) def _write_comment(comment, prefix=''):