Configuring Individual File Encoding
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.
IntelliJ IDEA suggests the following major ways to change encoding:
Using the File Encodings page of the Settings dialog, for directories and for the files that do not contain encoding information.
Using the Status bar or menu command, for individual files that do not contain encoding information.
Using the editor, for individual files that contain encoding information.
IntelliJ IDEA also supports configuring encoding for properties files.
To configure encoding for a directory or file without embedded encoding information
In the Settings/Preferences dialog (Ctrl+Alt+S), click File Encodings under Editor. The File Encodings page opens.
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:
To change encoding of a file that contains explicit encoding
Open the desired file in the editor.
Change explicit encoding information. Use error highlighting to recognize wrong encoding and press Ctrl+Space to have a list of available encodings displayed:
To change encoding of a single file that doesn't contain explicit encoding
Open the desired file for editing.
- Do one of the following:
From the main menu, choose.
Click file encoding on the Status bar.
Select the desired encoding from the pop-up window.
If the selected encoding will change the file contents, IntelliJ IDEA shows a dialog box, where you can choose tofile from disk, or it to a different encoding.