参考一下下面的例子吧。
private string ConvertBig5toGB2312(string source)
{
Encoding big = Encoding.GetEncoding("Big5");
Encoding gb = Encoding.GetEncoding("GB2312");
byte[] sourcearray = big.GetBytes( source );
byte[] gbarray = Encoding.Convert( big, gb, sourcearray );
return gb.GetString( gbarray );
}
string source = "說";
string result = ConvertBig5toGB2312( source );
----------------------------------------
编码转换:
string source = "表明你的不同尋常很有個性";
Encoding big = Encoding.GetEncoding("big5");
Encoding utf = Encoding.UTF8;
byte[] srcarray = big.GetBytes(source);
byte[] utfarray = Encoding.Convert( big, utf, srcarray );
string utfresult = utf.GetString( utfarray );
Console.WriteLine( utfresult );
文章来源:http://ms.mblogger.cn/xuzhong/posts/16897.aspx