Is it possible to change file's encoding from UTF-8 to windows1251 without cyrillic information lost. Because when I explicitely change the encoding, all cyrillic symbols become unreadable?
2 Answers
UPDATE: new IDE versions can convert encodings:
The problem is that IntelliJ IDEA doesn't actually convert your file encoding from UTF-8
to windows-1251
, what happens is that you tell IntelliJ IDEA to treat UTF-8
file as being encoded in windows-1251
, so you will see garbage in the editor. The actual file on disk remains in UTF-8
.
You have to use some external tool to perform the conversion, such as iconv:
iconv.exe -f utf-8 -t windows-1251 <input file> > <output file>

- 389,263
- 172
- 990
- 904
Newer versions of IntelliJ will ask if you would like to "Reload" or "Convert" the file to the new encoding.
I had a file that was displayed using UTF-8
but was actually written in x-macRoman
. I selected x-macRoman
and chose "Reload" so that the encoding would be used to interpret the file, I then chose UTF-8
and selected "Convert". Now my file is properly encoded as UTF-8
Tested With: version 12.1.3

- 19,449
- 25
- 93
- 144