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?
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>
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With