Different types of files use different ways to define encoding. IntelliJ IDEA recognizes encoding of files based on their contents.
Encoding has influence on the way IntelliJ IDEA reads or writes files. If a file has been modified but not yet saved, any changes in encoding affect file writing; if a file has not been modified, then reading is affected. IntelliJ IDEA suggests specific ways to change encoding of a file according to its type, using File Encodings Settings page, the Status bar, or the editor.
Can be changed in
File encoding is specified within the file, for example, in XML.
If a file contains explicit encoding declaration, you can change it in the Editor. In this case IntelliJ IDEA provides code completion.
File encoding is defined by BOM.
In this case, you can't change encoding with which IntelliJ IDEA reads the file, but it is still possible to change encoding for writing such file.
UTF characters are detected in the file contents.
IntelliJ IDEA provides an option that automatically changes file encoding to UTF, if the file contents can be reasonably interpreted as UTF.
Encoding cannot be found out from the file content.
In this case, the default encoding is the one defined by the IDE encoding in the File Encodings page of the Settings dialog. You can change it for multiple files and directories, or for a single file.
For the properties files, system default encoding is used. Though the characters in the other encodings are processed as unknown symbols, it is still possible to use them, by feeding such characters as escape sequences (for which IntelliJ IDEA provides the Transparent native-to-ASCII conversion option), or defining the default encoding for properties files.