public static string GetEncodingString(string srcString)
{
Encoding e8859Encode = Encoding.GetEncoding("iso-8859-1");
Encoding srcEncode = Encoding.GetEncoding("gb2312");
Encoding dstEncode = Encoding.Unicode;
byte[] srcBytes = e8859Encode.GetBytes(srcString);//用iso-8859-1去转换源字符串
byte[] dstBytes = Encoding.Convert(srcEncode, dstEncode, srcBytes);//但是,是从gb2312转到unicode的
char[] dstChars = new char[dstEncode.GetCharCount(dstBytes, 0, dstBytes.Length)];
dstEncode.GetChars(dstBytes, 0, dstBytes.Length, dstChars, 0);
return new string(dstChars);
}
{
Encoding e8859Encode = Encoding.GetEncoding("iso-8859-1");
Encoding srcEncode = Encoding.GetEncoding("gb2312");
Encoding dstEncode = Encoding.Unicode;
byte[] srcBytes = e8859Encode.GetBytes(srcString);//用iso-8859-1去转换源字符串
byte[] dstBytes = Encoding.Convert(srcEncode, dstEncode, srcBytes);//但是,是从gb2312转到unicode的
char[] dstChars = new char[dstEncode.GetCharCount(dstBytes, 0, dstBytes.Length)];
dstEncode.GetChars(dstBytes, 0, dstBytes.Length, dstChars, 0);
return new string(dstChars);
}