Encoding problem on Windows
Closed this issue · 4 comments
ljonathanl commented
HI,
I have this file for example:
var t = "Á";
And when I save it I have this error:
File "...\Sublime Text 3\Packages\T3S\lib\Utils.py", line 112, in get_data
if os.name == 'nt': f = open(file,'r').read()
File "X/encodings/cp1252.py", line 23, in decode
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 10: character maps to <undefined>
I fixe it by commenting line 112 concerning windows in Utils.py line:
#if os.name == 'nt': f = open(file,'r').read()
#else:
f = codecs.open(file,'r','utf-8').read()
Do you think it is necessary to check OS when reading a file, because codecs.open function seems to work on my Windows 7 ?
Railk commented
hello,
codecs.open doesn't play nice with line_endings on Windows thats why i was doing this check, i'll try look a your porblem and see if can correct that one way or another.
ljonathanl commented
Thank you for the answer, and thank you too for this great plugin.
Railk commented
Hello,
I've enforced utf8 reading on windows too and so it resolve this problem.
ljonathanl commented
Thanks ;)