In this tutorial, You learn how to change the VSCode encoding to (UTF-8,UTF-16,ANSI,ISO-8859-1,Arabic, Japanese)
There are multiple ways we can do this
- Change encoding to opened file
- Update encoding permanently and globally in VSCode
What is default encoding for Visual studio code? Default encoding is UTF-8. you can change it
How to change encoding for a open file in VS Code
In this approach, You can change the encoding for a single file or opened file.
Open a file in Visual studio Code, If file is not opened, The below option is not visible
You will see the
UTF-8 text in bottom bar of Visual studio code
- Clicking on UTF-8 label, you will see two options as seen below
Select One of the option below
- Reopen with Encoding- The file is reopened with selected encoding
- Save with Encoding - File is saved with selected encoding. you can choose one of the option from above.
Again one more popup appears to select encoding from all encoding lists as seen below
you can select one from the list i.e Japanese or Korean or your required one.
That’s it, file will be opened or saved with selected encoding
This approach only works for single file.
What is short code to change encoding in VSCODE? Alternatively, you can change the encoding with single file for below command CTRL+SHIFT+P command and type encoding and select Reopen or save with encoding option
Set Encoding globally in Visual Studio Code
Go to Settings in Visual studio code
In Windows, you can select
Preferences-> Settings Alternatively, you can open using short keys(
CTRL + ,) Command
In MAC:- Code -> Preferences -> Settings Alternatively, you can open using short keys(
Command + ,) Command
It opens an settings window and type
encodingand change default encoding from a given list on
Files: Encodingoption as seen below
This changes encoding globally in VSCode and newly created files will be saved with new encoding.