I have data in an unknown encoding. Presumably (almost certain), this is windows-1251 or 1252. The known methods for decoding the Encoding.UTF8.GetString(Encoding.GetEncoding(1251).GetBytes(str)) type Encoding.UTF8.GetString(Encoding.GetEncoding(1251).GetBytes(str)) do not produce a result (the line changes, but remains unreadable). If you are interested here, for example, the line looks like this when outputting in the console: ia?niiae , and so if you write it to a file: ïåðñîíàë (this is without transcoding). Tell me what else to try?
- I have data - this data where: in the file, in an array of bytes, or already in the string System.String? - Alexander Petrov
- Strings in dotnet can have only one encoding: UTF-16. All other encodings can only be represented as an array of bytes. Of course, it is also possible to place strings in any encoding as a byte array in a file or stream. - Alexander Petrov
|
1 answer
Artemy Lebedev decoder in the internet look. Get there, he will show what kind of encoding. and then encoding
- Well, he sort of showed that: CP1252 -> CP1251. And the truth is that it becomes readable. And now how can I overtake it in utf-8? That's how I deciphered to a readable form:
Encoding.GetEncoding(1251).GetString(Encoding.GetEncoding(1252).GetBytes(str)), and now I additionally want to overtake it in Unicode (so it is more modern and so that such problems no longer It was). I'm trying to do the resulting string in the same way:Encoding.UTF8.GetString(Encoding.GetEncoding(1251).GetBytes(str)), but I get only a bunch of question marks. What is the problem? - PECHAPTER - You are shown that CP1252 -> CP1251. And you do
GetEncoding(1251)- Bulson - @Bulson I'm doing the right thing. I told it already to the recoded line is applied. - PECHAPTER
- @Bulson Maybe it will be clearer to you: skrinshoter.ru/i/260119/5ZFnFMZC.png - PECHAILTER
|