ST3 Build 3175 | Windows 10
I’m working on a project where source code files are in ISO-8859-1.
The file extensions are correctly associated to the encoding via a custom syntax definition.
The problem only occurs when I close a source file and reopen it, or if I open a new file with special chars (but not always). If the file contains some characters out of the Ascii range (but valid ISO-8859-1 Latin characters) the file is often (but not always) shown as bein UTF-8 (ie, in the bottom bar it shows “UTF-8”, and some chars are wrongly encoded as ?
).
Even if I change the enconding back to ISO-8859-1 (via the encoding menu on the bottom bar of ST3) I often need to close and restart ST for the characters to show up properly — even though some other files with the same extension are showing up properly encoded.
Proper character representation is usually preserved from session to session, the problem only occur when opening a file (eg, closing it and reopening it). It usually only occurs when the file contains accented letters (Italian accented vowels, or some other non-Ascii chars).
Initially I though that it might have been due to some out-of-range character being accidently pasted into the text, and the file being forced to UTF-8 in order to accomodate it, but then I just discovered it was a representation problem that required restarting the app.
As for the last point mentioned — ie, pasting a character which is out of the encoding range — I think that ST should warn before switching encoding to UTF-8, because once it has switched it seems that trying to undo the copy operation doesn’t restore the file encoding back, so this might be an encoding breaking operation and ST should protect files which have been set to be strictly in a given encoding! But maybe the undo problem is tied to the fact that currently ST can’t handle refershing the file encoding without restarting.
Example File
Here is a link to a file that shows the problematic behavior mentioned above:
https://github.com/tajmone/Alan3-Italian/blob/master/alanlib_ita/lib_definizioni.i
That file is valid ISO-8859-1 and it compiles correctly with the target compiler. I’ve worked on in in ST3 since the onset, experiencing the problems stated above when I close and reopen it.