How to Set Character Encoding in Code Editors

When building websites, your code files should be saved using the UTF-8 character encoding to ensure that all of the characters display as you intend them to.

UTF-8 is the default character encoding used in the code editors and IDEs (Integrated Development Environments) shown below, but you can use the instructions below to check that this setting has not been changed.

Sublime Text:

To open the text file that holds the settings for Sublime Text, go to:
Sublime Text > Preferences > Settings
Preferences > Settings

Search for the words: default_encoding.
The value should be "default_encoding": "UTF-8",

Sublime text settings window showing the default_encoding setting

VS Code:

To bring up the Settings window for VS Code, go to:
Code > Preferences > Settings
File > Preferences > Settings

Then select Text Editor > Files
The default encoding should be set to UTF-8

Visual Studio Code settings window showing the default encoding setting


To edit the Atom settings window, go to:
Atom > Preferences
File > Settings

Open the Core section
The File Encoding setting should be set to Unicode (UTF-8)

Atom settings window showing the default encoding setting


To open the PHP Storm Preferences window, go to:
PHPStorm > Preferences
File > Settings

Select Editor > File Encodings
There are drop-down select boxes for Global and Project encodings. Both should be set to UTF-8.

PHP Storm Preferences window showing file encodings being set to UTF-8


To open the Eclipse Preferences window, go to:
Eclipse > Preferences
Window > Preferences

Go to the General > Content Types option.
Set UTF-8 as the default encoding for all content types.

Go to the General > Workspace option.
Set Text file encoding to Other : UTF-8

Eclipse Settings window