SublimeText / TrailingSpaces

Highlight trailing spaces and delete them in a flash.
MIT License
897 stars 94 forks source link

ST3: UnicodeDecodeError on non-UTF-8 files #64

Closed semond closed 3 years ago

semond commented 10 years ago

When editing old code written in CP1252, I get this in the console:

Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 303, in on_activated
    callback.on_activated(v)
  File "trailing_spaces in /Users/serge/Library/Application Support/Sublime Text 3/Installed Packages/TrailingSpaces.sublime-package", line 395, in on_activated
  File "trailing_spaces in /Users/serge/Library/Application Support/Sublime Text 3/Installed Packages/TrailingSpaces.sublime-package", line 416, in freeze_last_version
  File "X/codecs.py", line 679, in read
  File "X/codecs.py", line 482, in read
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 607: invalid continuation byte

0xe9 is latin-1 for "é" (and is also the same in unicode, not as UTF-8). ST3 properly detects the CP1252 encoding.