pygettext: explicitly open files as utf-8

When running it through SSH, I couldn't open files with non-ascii chars.
This commit is contained in:
Virgil Dupras 2013-11-24 10:22:05 -05:00
parent c1cfa86ad1
commit 0b00171655
1 changed files with 3 additions and 3 deletions

View File

@ -378,7 +378,7 @@ def main(source_files, outpath, keywords=None):
# initialize list of strings to exclude
if options.excludefilename:
try:
fp = open(options.excludefilename)
fp = open(options.excludefilename, encoding='utf-8')
options.toexclude = fp.readlines()
fp.close()
except IOError:
@ -392,7 +392,7 @@ def main(source_files, outpath, keywords=None):
for filename in source_files:
if options.verbose:
print('Working on %s' % filename)
fp = open(filename)
fp = open(filename, encoding='utf-8')
closep = 1
try:
eater.set_filename(filename)
@ -408,7 +408,7 @@ def main(source_files, outpath, keywords=None):
if closep:
fp.close()
fp = open(options.outfile, 'w')
fp = open(options.outfile, 'w', encoding='utf-8')
closep = 1
try:
eater.write(fp)