WebStorm 2017.1 Help

Configuring Individual File Encoding

On this page:

Basics

There are two modes of dealing with file encoding:

  • Converting: the contents of the editor are stored in a different encoding. So doing, the contents of the underlying file change, but the contents of the editor stay unchanged.
  • Reloading: the underlying file, opened in the editor, is shown in an encoding that differs from its original one. So doing, the contents of the editor can change, but the underlying files does not.

WebStorm suggests the following major ways to change encoding:

Configuring encoding for a directory or file without embedded encoding information

To configure encoding for a directory or file without embedded encoding information

  1. In Settings, expand the Editor node and select File Encodings.
  2. The File/Directory column shows the tree view of your project. The Default Encoding column shows encoding for directories or files. Click the Default encoding column for a directory or file you want to define encoding for, and then choose the desired encoding from the drop-down list:
    encoding.png

Changing encoding of a file with explicit encoding

To change encoding of a file that contains explicit encoding

  1. Open the desired file in the editor.
  2. Change explicit encoding information. Use error highlighting to recognize wrong encoding and press Ctrl+Space to have a list of available encodings displayed:
    encoding3.png

Changing encoding of a file without explicit encoding

To change encoding of a single file that doesn't contain explicit encoding

  1. Open the desired file for editing.
  2. Do one of the following:
    • On the main menu, point to File | File encoding.
    • Click file encoding on the Status bar.
  3. Select the desired encoding from the pop-up window.
    encoding2.png
  4. If the selected encoding will change the file contents, WebStorm shows a dialog box, where you can choose to Reload file from disk, or Convert it to a different encoding.

See Also

Last modified: 17 July 2017