Sublime Forum

Stop file encoding being changed?

#1

Hi,

Is there a way to stop a file being converted from ANSI (correct), to UTF8? It causes all kinds of issues for me, as I’m running in ISO-8859-1, with the templates as ANSI (so when it converts to UTF8, it screws up the whole system)

Thanks :slightly_smiling:

Andy

0 Likes

#2

Sublime typically doesn’t make any changes to file encoding. Maybe it can’t detect the encoding correctly when it opens your document, so uses the fallback encoding defined in the preferences. Maybe you could set the following two preferences to "Western (ISO 8859-1)", and that would work for your use case.

// The encoding to use when the encoding can't be determined automatically.
// ASCII, UTF-8 and UTF-16 encodings will be automatically detected.
"fallback_encoding": "Western (Windows 1252)",

// Encoding used when saving new files, and files opened with an undefined
// encoding (e.g., plain ascii files). If a file is opened with a specific
// encoding (either detected or given explicitly), this setting will be
// ignored, and the file will be saved with the encoding it was opened
// with.
"default_encoding": "UTF-8",
0 Likes

#3

Thanks - will give that a go :slight_smile:

0 Likes