Sublime Forum

Way to stop file converting to UTF8?

#1

Hi,

I’ve got a bit of an annoying issue, where sublime decides that because my file looks a bit like this:

'PROFILE_EMAIL_CHANGE_NOTE' => 'un email de vérification va être envoyé', 'BUYER_COMPLAIN_TEXT' => 'Si vous avez un besoin de vous plaindre au sujet de votre commande, s\'il vous plaît utiliser le formulaire ci-dessous. Nous allons tenter de vous répondre dès que possible. S\'il vous plaît soyez aussi descriptif que possible pour nous aider à agir le plus rapidement possible.', 'WANT_SHOW_INCH' => 'INCH', 'EMAIL_BUYER_NOTIFICATION_TEXT1' => 'Cet email pour vous confirmer que votre dépôt à bien été reçu pour l\'oeuvre "<b>%s</b>". L\'artiste va prendre contact dans les prochains jours avec vous pour organiser l\'envoi et finaliser la vente (y.c. les frais d\'envoi. Attention, si vous ne vivez pas dans le même pays que l\'oeuvre, le prix d\'envoi sera calculé en conséquence', 'ORDER_PANEL_NO_ORDERS_FOUND' => 'Pas de commande trouvés!', 'RELATED_TAGS' => 'Mots clés', 'SIGNUP_AGREE_TOS' => 'J\'accepte les <a href="/tos">conditions</a>', 'ERROR_TITLE' => 'Mince, une erreur!', 'EMAIL_ORDER_DISPATCHED_SUBJECT' => 'Votre commande à été envoyée', 'HEADER_LANG_FR' => 'Français',

…it wants to convert it into UTF8. Normally, that wouldn’t be a problem. However, on this site I am using ISO-8859-1 for it all, so it needs to be in iso-8859-1. If I try and force it to save with a different encoding, it comes up with an alert telling me that its falling back to utf8. Is there anything I can do to stop this?

I’m currently having to change my editor just for that file to use NotePad++, as that lets me keep it as iso-8859-1 (and convert the broken utf8 file into iso-8859-1)

BTW - why can’t we set email notifications to threads on here?

TIA

Andy

0 Likes

#2

There are whole unanswered threads of people asking this same question.

Unfortunately I don’t know anything about the encoding problem though :\

0 Likes

#3

Not sure I understand your problem.

There are 2 settings for opening/saving files:

[code] // 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",[/code]

If you try to open a file with a encoding different of ASCII, UTF-8 and UTF-16, ST will use the fallback_encoding.
If your fallback_encoding is ISO-8859-1, everything must works flawlessly.
If your fallback_encoding is different, you must use the ‘Reopen with Encoding’ menu to open the file with the correct encoding.

You can check which encoding is used in the console when you open the file, eg:

Unable to auto detect encoding, using fallback encoding Western (Windows 1252) 

If you want to check the current encoding of a file (view), type in the console:

view.encoding()

For new file, the default_encoding is used.
If you want another encoding, you must use the ‘Save with Encoding’ menu.

0 Likes

#4

Hi,

Sorry for the late reply - totally forgot to check for replies (another reason we need notifications on this forum :frowning: )

I’m not really 100% sure what the problem is myself, although I just had the same issue again. A new file I made was in UTF8, but I wanted it in ANSI. It was screwing up all the accents when copying the contents of that file into a proper ANSI file. I’ve tweaked the config like so:

"default_encoding": "Western (Windows 1252)",

Hopefully that fixes it now :smile: Thanks for the reply!

Andy

0 Likes