parent
cde990a9a0
commit
528ea56424
2 changed files with 9 additions and 2 deletions
|
@ -274,6 +274,9 @@ def convertor(linefilter, arglist, exclude):
|
|||
except bailout as e:
|
||||
print('wmlindent: "%s", %d: %s' % (e.filename, e.lineno, e.msg), file=sys.stderr)
|
||||
os.remove(filename + ".out")
|
||||
except UnicodeDecodeError as e:
|
||||
os.remove(filename + ".out")
|
||||
print('wmlindent: "{}" is not a valid UTF-8 file'.format(filename), file=sys.stderr)
|
||||
except KeyboardInterrupt:
|
||||
os.remove(filename + ".out")
|
||||
print("wmlindent: %s interrupted" % filename, file=sys.stderr)
|
||||
|
|
|
@ -2839,8 +2839,12 @@ def translator(filename, mapxforms, textxform):
|
|||
with gzip.open(filename) as content:
|
||||
unmodified = content.readlines()
|
||||
else:
|
||||
with codecs.open(filename, "r", "utf8") as content:
|
||||
unmodified = content.readlines()
|
||||
try:
|
||||
with codecs.open(filename, "r", "utf8") as content:
|
||||
unmodified = content.readlines()
|
||||
except UnicodeDecodeError as e:
|
||||
print('wmllint: "{}" is not a valid UTF-8 file'.format(filename), file=sys.stderr)
|
||||
return
|
||||
# Pull file into an array of lines, CR-stripping as needed
|
||||
mfile = []
|
||||
map_only = filename.endswith(".map")
|
||||
|
|
Loading…
Add table
Reference in a new issue