iv-mexx/update_localization

update_localization fails with an encoding error

ishaq opened this issue · 2 comments

I have seen this a couple of times, then somehow it fixed itself, Since I can't reproduce it, can't fix it.
Am putting it here anyway to keep it on the radar.

ishaqs-mac:update_localization Ishaq$ ./update_localization.py --verbose --input ../../myappname/ --output ../../myappname/nl.lproj/ --verbose --interface
Traceback (most recent call last):
  File "./update_localization.py", line 1000, in <module>
    sys.exit(main())
  File "./update_localization.py", line 995, in main
    ignore_patterns=options.ignore_patterns)
  File "./update_localization.py", line 839, in gen_strings_interface
    merge_files(export_path, current_file_path, gen_path, keep_comment=True)
  File "./update_localization.py", line 906, in merge_files
    old_strings = parse_file(old_file_path)
  File "./update_localization.py", line 714, in parse_file
    for line in file_contents:
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/codecs.py", line 684, in next
    return self.reader.next()
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/codecs.py", line 615, in next
    line = self.readline()
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/codecs.py", line 530, in readline
    data = self.read(readsize, firstline=True)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/codecs.py", line 477, in read
    newchars, decodedbytes = self.decode(data, self.errors)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/utf_16.py", line 112, in decode
    raise UnicodeError,"UTF-16 stream does not start with BOM"
UnicodeError: UTF-16 stream does not start with BOM

figured it out, it fails whenever it tries to read a file in UTF-8 encoding. I'll try to fix it and send a PR

PR submitted, closing.