nullic / DPLocalizationManager

Provides way to change localization inside application
MIT License
81 stars 21 forks source link

dpstrings.py encoding problem #5

Closed creatd closed 9 years ago

creatd commented 9 years ago

I tried running dpstrings.py with many different variations (no parameter, parameter with absolute and relative paths, with and without quotation marks, one language, multiple languages) but couldn't get rid of the UnicodeDecodeError

Terminal log below

Eges-MacBook-Pro:FordStore ege$ python dpstrings.py Traceback (most recent call last): File "dpstrings.py", line 126, in local_strings = DPLocalizableStringsParser().scan_dir(search_path) File "dpstrings.py", line 107, in scan_dir self.scan_dir(full_path) File "dpstrings.py", line 107, in scan_dir self.scan_dir(full_path) File "dpstrings.py", line 107, in scan_dir self.scan_dir(full_path) File "dpstrings.py", line 107, in scan_dir self.scan_dir(full_path) File "dpstrings.py", line 107, in scan_dir self.scan_dir(full_path) File "dpstrings.py", line 107, in scan_dir self.scan_dir(full_path) File "dpstrings.py", line 107, in scan_dir self.scan_dir(full_path) File "dpstrings.py", line 105, in scan_dir self.extract_strings(full_path, patterns) File "dpstrings.py", line 79, in extract_strings text = codecs.open(path, encoding='utf-8').read() File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/codecs.py", line 671, in read return self.reader.read(size) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/codecs.py", line 477, in read newchars, decodedbytes = self.decode(data, self.errors) UnicodeDecodeError: 'utf8' codec can't decode byte 0xdf in position 8: invalid continuation byte

nullic commented 9 years ago

Script have been updated. Now it can read UTF-16 and UTF-8 encoded *.strings files.

creatd commented 9 years ago

Working like a charm now

Thanks mate