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?
Change file encoding without information losses in intellij idea
12k views Asked by Sergey At
2
There are 2 answers
0
On
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
UPDATE: new IDE versions can convert encodings:
The problem is that IntelliJ IDEA doesn't actually convert your file encoding from
UTF-8towindows-1251, what happens is that you tell IntelliJ IDEA to treatUTF-8file as being encoded inwindows-1251, so you will see garbage in the editor. The actual file on disk remains inUTF-8.You have to use some external tool to perform the conversion, such as iconv: