summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Morega <alex@grep.ro>2014-01-15 22:12:19 +0200
committerAlex Morega <alex@grep.ro>2014-01-15 22:13:04 +0200
commit514d41c0e73c58d43ace3ec310585bc48775196a (patch)
tree10c5a1c6b4b95056ef5044b322052e1369c05dbd
parentc21a3323d27f17556cd997a0f9279c6d0ec65be3 (diff)
downloadbabel-514d41c0e73c58d43ace3ec310585bc48775196a.tar.gz
read/write all PO files in binary mode
as pointed out in #52
-rwxr-xr-xbabel/messages/frontend.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/babel/messages/frontend.py b/babel/messages/frontend.py
index cead694..cd79ebf 100755
--- a/babel/messages/frontend.py
+++ b/babel/messages/frontend.py
@@ -128,7 +128,7 @@ class compile_catalog(Command):
for idx, (locale, po_file) in enumerate(po_files):
mo_file = mo_files[idx]
- infile = open(po_file, 'r')
+ infile = open(po_file, 'rb')
try:
catalog = read_po(infile, locale)
finally:
@@ -439,7 +439,7 @@ class init_catalog(Command):
log.info('creating catalog %r based on %r', self.output_file,
self.input_file)
- infile = open(self.input_file, 'r')
+ infile = open(self.input_file, 'rb')
try:
# Although reading from the catalog template, read_po must be fed
# the locale in order to correctly calculate plurals
@@ -554,7 +554,7 @@ class update_catalog(Command):
if not domain:
domain = os.path.splitext(os.path.basename(self.input_file))[0]
- infile = open(self.input_file, 'U')
+ infile = open(self.input_file, 'rb')
try:
template = read_po(infile)
finally:
@@ -566,7 +566,7 @@ class update_catalog(Command):
for locale, filename in po_files:
log.info('updating catalog %r based on %r', filename,
self.input_file)
- infile = open(filename, 'U')
+ infile = open(filename, 'rb')
try:
catalog = read_po(infile, locale=locale, domain=domain)
finally:
@@ -577,7 +577,7 @@ class update_catalog(Command):
tmpname = os.path.join(os.path.dirname(filename),
tempfile.gettempprefix() +
os.path.basename(filename))
- tmpfile = open(tmpname, 'w')
+ tmpfile = open(tmpname, 'wb')
try:
try:
write_po(tmpfile, catalog,
@@ -760,7 +760,7 @@ class CommandLineInterface(object):
for idx, (locale, po_file) in enumerate(po_files):
mo_file = mo_files[idx]
- infile = open(po_file, 'r')
+ infile = open(po_file, 'rb')
try:
catalog = read_po(infile, locale)
finally: