There is a file in the utf-8 encoding with the text ONLY in Latin. I try using notepad ++ to recode it in windows-1251. I save and re-open it, but the file is still read in utf-8 encoding (without BOM). Question: how can I make the file encoded in windows-1251, otherwise one program cannot use it. And how does any program that uses a file determine its encoding? Like for example the same notepad ++ can understand the encoding, if all the characters in it are in Latin, and their codes are the same in windows-1251 and utf-8?
- 2@eicto in the case of Latin frequency analysis to divide cp1251 and utf8 with a complicated one :) I think that notepad ++ just takes utf8 as a better option. - KoVadim
- and then how can I get the program to see this file in windows-1251 encoding, without changing the visible content? We just bought a program from us and it needs a file in this particular encoding. The owner of the program sent us a file that was first in windows-1251 and there were only Latin characters in it, but we re-saved this file without adding anything and now it is impossible to return it again to windows-1251 encoding - Alexander Zheleznovsky
- oneI would take any utility that can compare binary files (for example, cjmweb.net/vbindiff ). Next, I took the original file sent, opened it in the editor and saved it with a new name (now it should "change the encoding"). After that would make a comparison. I suspect that there are a couple of characters that spoil everything. - KoVadim
- one@KoVadim if it is text in Latin without a single control code, then it is not-utf (well, or utf, in short its encoding is utf / latin-1 does not matter, just as it is impossible to say from the mark which language is written " A ") - zb '
2 answers
Actually, where did you get the idea that there is no BOM in your file?
If the text file is ONLY in Latin, then the utf-8 and 1251 encodings differ only in the presence / absence of BOM.
Actually, what you wrote about re-saving is just very similar to adding BOM.
Another question that no BOM editor will display to you. There is some hope for the Far editor, but most likely it will not be so easy to make it display these symbols.
In general, you need to remove the first two bytes from the file (well, or you can wipe them with spaces), and this should be done not in a text editor (well, or in an editor who does not know what utf-8 is).
Total Commander-> F4-> In AikelPad Save As-> Below select the name, extension and encoding