一般而言,都使用System.Text.Encoding.Defaut。 Gets an encoding for the system's current ANSI code page.[C#] public static Encoding Default {get;}Property Value An encoding for the system's current ANSI code page.如果想自动判断是某种编码,还真比较有难度,否则的XML种也不需要标记字符集是gb2312或utf-8了, 因为默认方式都是utf-8.当然使用System.Text.Encoding.Defaut,可以很好地帮你回避掉乱码的问题。
在日文系统下,直接从sql server 2000中复制粘贴数据到txt文件中,然后在中文系统中打开,是乱码。我用Encoding 中的Ascii,Default ,unicode,utf8,utf7,bigunicode这几种方式通过程序读取,用default读取是乱码,好像用unicode,utf8才不是乱码
Gets an encoding for the system's current ANSI code page.[C#]
public static Encoding Default {get;}Property Value
An encoding for the system's current ANSI code page.如果想自动判断是某种编码,还真比较有难度,否则的XML种也不需要标记字符集是gb2312或utf-8了,
因为默认方式都是utf-8.当然使用System.Text.Encoding.Defaut,可以很好地帮你回避掉乱码的问题。
顶