/// <Summary>
/// Convert utf_8 to GB2312
/// </Summary>
/// <Param name = "utfInfo"> </param>
/// <Returns> </returns>
Private string ToGB2312 (string utfInfo)
{
String gb2312Info = string. Empty;
Encoding utf8 = Encoding. UTF8;
Encoding gb2312 = Encoding. GetEncoding ("gb2312 ");
Byte [] unicodeBytes = utf8.GetBytes (utfInfo );
Byte [] asciiBytes = Encoding. Convert (utf8, gb2312, unicodeBytes );
Char [] asciiChars = new char [gb2312.GetCharCount (asciiBytes, 0, asciiBytes. Length)];
Gb2312.GetChars (asciiBytes, 0, asciiBytes. Length, asciiChars, 0 );
String gb2312info = new string (asciiChars );
Return gb2312info;
}
/// <Summary>
/// GB2312 to UTF-8
/// </Summary>
/// <Param name = "gbInfo"> </param>
/// <Returns> </returns>
Private string ToUTF8 (string gbInfo)
{
String Info = string. Empty;
Encoding gb2312 = Encoding. GetEncoding ("gb2312 ");
Encoding utf_8 = Encoding. GetEncoding ("UTF-8 ");
Byte [] unicodeBytes = gb2312.GetBytes (gbInfo );
Byte [] asciiBytes = Encoding. Convert (gb2312, utf_8, unicodeBytes );
Char [] asciiChars = new char [utf_8.GetCharCount (asciiBytes, 0, asciiBytes. Length)];
Utf_8.GetChars (asciiBytes, 0, asciiBytes. Length, asciiChars, 0 );
String info = new string (asciiChars );
Return info;
}