]> git.ipfire.org Git - thirdparty/babel.git/commitdiff
babel.messages.pofile should only apply encoding when actually writing a file (eases...
authorFelix Schwarz <felix.schwarz@oss.schwarz.eu>
Sat, 19 Mar 2011 19:50:21 +0000 (19:50 +0000)
committerFelix Schwarz <felix.schwarz@oss.schwarz.eu>
Sat, 19 Mar 2011 19:50:21 +0000 (19:50 +0000)
babel/messages/pofile.py

index 3761e04ee5ee5f69f8238bd1c3fb69cc14dc6937..5a0ef298e48016876368f4da185acadf88eaa744 100644 (file)
@@ -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=''):