Character encoding converts Using System.IO;
1.System.io.streamReader Read = New StreamReader (@ "c: /trynew.txt", system.text.encoding.getencoding ("GB2312")); 2. Use byte arrays to convert. System.Text.Encoding ansi = System.Text.Encoding.Default; System.Text.Encoding utf8 = System.Text.Encoding.UTF8; System.Text.Encoding gb2312 = System.Text.Encoding.GetEncoding ( "GB2312");
Byte [] sa = ansi.getbytes (DOG); DOG = ANSI.GETSTSTRING (SA);
3. Use System.Text.Encoding.convert to convert.
Also: Use Notepad, save the coding to UTF8, can be successfully read. When writing to a database, if the database is another coding system, you must convert UTF8 to ISO8859-1, then write to the database, and then reverse conversion.