Really do not understand TX, user name coding unexpectedly return the value is not the same, such as "Leilei 52D", there are the following two kinds of return? Leilei 52D and%01%u96f7%u78ca%0152d. It's pretty depressing. Fortunately, TX also has the return of Chinese names, the decoding process is omitted, but still recorded.
Copy Code code as follows:
<summary>
Unicode character converts to Chinese characters, such as 96F7,78CA, etc.
</summary>
Private char Unicodetochinesebyhex (string Unicode)
{
return (char) int. Parse (Unicode, System.Globalization.NumberStyles.HexNumber);
}
<summary>
Unicode character converts to Chinese characters, such as 96f7,78ca
Note: Decoding from the back forward
</summary>
private string Unicodetochinese (String Unicode)
{
byte[] array = new BYTE[UNICODE.LENGTH/2];
for (int i = 0; i < array. Length; i++)
{
string S1 = unicode.substring (Unicode.length-(i + 1) * 2, 2);
int T1 = Convert.ToInt32 (S1, 16);
Array[i] = (byte) t1;
}
return System.Text.Encoding.Unicode.GetString (array);
}
<summary>
Converts to Unicode characters such as ' thunder '
</summary>
private string Chinesetounicode (char Chinese)
{
return ((int) Chinese). ToString ("X");
}