HEX String to Chinese String

前端 未结 1 1409
眼角桃花
眼角桃花 2021-01-23 07:32

I have the following code to convert from HEX to ASCII.

//Hexadecimal to ASCII Convertion
private static string hex2ascii(string hexString)
{
    MessageBox.Show         


        
1条回答
  •  囚心锁ツ
    2021-01-23 08:13

    First, convert the hex string to a byte[], e.g. using code at How do you convert Byte Array to Hexadecimal String, and vice versa?. Then use System.Text.Encoding.Unicode.GetString(myArray) (use proper encoding, might not be Unicode, but judging from your example it is a 16-bit encoding, which, incidentally, is not "ASCII", which is 7-bit) to convert it to a string.

    0 讨论(0)
提交回复
热议问题