FCL provides UTF7Encoding, UTF8Encoding, ASCIIEncoding, UnicodeEncoding, four kinds of codecs, can not correctly decode ansi encoding (multi-byte string), what should I do?
What language is written in ansi, which language is used to decode, personally think that it is only related to the operating system
Such as Chinese system
StreamReader sr=new StreamReader(@"d:\test.txt",Encoding.GetEncoding("gb2312"));
//gb2312 is the system language encoding when saving
Thank you! Use Encoding.Defalut to get the encoding associated with the default ANSI code page in the system locale.
But what if you want to go further and determine which encoding to use for the string?
As in ie, the encoding method can be selected automatically. But to be precise, I don’t know if there is such a possibility, or how likely is the automatic selection of ie (except gb2312 and unicode, unicode is mostly with a byte order mark)