

See Settings → File Encoding → Project Encoding → IDE Encoding. For example, when Auto-detect UTF-8 is selected, the IDE will analyze the file looking for some byte combinations which are UTF-8-specific.įinally, use the project-level or, if the project is unavailable, the application-level encoding. Try to figure out the encoding using some hints or heuristics. IntelliJ IDEA will use the most specific encoding:

You can specify the desired encoding for the file or for the containing directory or for the whole project or for the IDE. For example, JSP files can specify the encoding right in the text:Ĭheck if you have specified the encoding explicitly and use that. Check if the file type declares the encoding itself and use that. IntelliJ IDEA uses multi-stage educated guessing, from most obvious to far-stretched.įirst, if the BOM present, use the corresponding UTF-family encoding. How does the IDE determine encoding for the file? That’s why UTF-8 is so popular and that’s why it’s the most preferred encoding. In particular, for an English character subset, the UTF-8 encoded file looks exactly like old plain ASCII text.

Today we would like to answer the most frequent questions about file encodings in the IDE and show you a few tricks, which may help you to avoid potential pitfalls. What is the ultimate advice you have regarding file encodings?.What happens when I try to change the file encoding?.How does the IDE determine encoding for the file?.What is the problem with file encodings?.
