Sublime Forum

How to automatically open with specific encoding for some file extensions?



Is there any way to force sublime (ST3) to open/reopen some kind of file with specific encoding? My problem is: I don’t want ST3 to show content for specific file extension (i.e. .log, .dump, and my any other custom files). The current solution is to set the encoding manually to Hexadecimal through the view.set_encoding() method. The other solution was proposed on this discussion. But it seems only set the encoding after the file was opened. Is there any way to automatically open, or reopen those files with Hexadecimal encoding?

Sorry for my English :smiley:

1 Like


I’ve set the default_encoding to UTF-8 and fallback to Hexadecimal. Since ST3 detect the content of my custom files as UTF-8, the content was then shown. I just want ST3 to show Hexadecimal view for some kind of custom files, and have to manually change the encoding to show/modify the content.

Thanks again!



I’m having the same issue that you. Some projects i use the iso-8859-1 encoding for all the files, and for other clients i use utf-8 (depending on their demands).

Since i set the default encoding in st3 as utf-8 when i open the iso-8859-1 files i have to go to file > reopen with encoding … otherwiser i can easilly fuc* the entire file …

how can i solve that ? Could st3 auto detect the encoding of the file ?