'gb2312' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider meth...
string Path = @"E:\SQLQuery.sql"; Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);// 使用了gb2312 需要定义 StreamReader sr = new StreamReader(Path, Encoding.GetEncoding("gb2312")); //sr.ReadToEnd().Dump(); Console.WriteLine(sr.ReadToEnd()); sr.Close();
标签:Encoding,C#,sr,encoding,gb2312,乱码 From: https://www.cnblogs.com/zeng-qh/p/17379366.html