How to setup Visual Studio Code to detect and set the correct encoding on file open

To allow Visual Studio Code to automatically detect the encoding of a file, you can set "files.autoGuessEncoding":true (in the settings.json configuration file).

https://github.com/Microsoft/vscode/pull/21416

This obviously requires an updated verison of the application compared to when the question was originally asked.


  • Go to File-> Preferences -> User Settings
  • Add (or update) the entry "files.encoding": "windows1252" to the right editor window and save

Now VSCode opens all text files using windows-1252 when there is no proper encoding information set.

EDIT: In 2017's June release the files.autoGuessEncoding setting was introduced. When enabled it will guess the file's encoding as good as possible. Its default value is false .


Add guide by image :

File >> Preferences >> Settings

File >> Preferences >> Settings

Enter autoGuessEncoding and make sure checkbox is checked

Enter autoGuessEncoding