0

I am trying to get the Chinese character from receiving Hex values. For example I am receiving "4560597D5417" for chinese "你好吗"(How are you) And my program is sending message to user hand phone but my program does not convert Hex values into chinese that's why user can see "4560597D5417" instead of the "你好吗". To over come this situation I have to convert the Hex into chinese to send into users hand phone. Here is one example I have taken from the internet but I am not getting my result with it:

 public static string ConvertHex(String hexString)
{
    try
    {
        string ascii = string.Empty;

        for (int i = 0; i < hexString.Length; i += 2)
        {
            String hs = string.Empty;

            hs = hexString.Substring(i, 2);
            uint decval = System.Convert.ToUInt32(hs, 16);
            char character = System.Convert.ToChar(decval);
            ascii += character;

        }

        return ascii;
    }
    catch (Exception ex) { Console.WriteLine(ex.Message); }

    return string.Empty;
}

Appreciate any help.

barsan
  • 2,431
  • 16
  • 45
  • 62
  • http://stackoverflow.com/q/10419279/2376607 check the link – Rajeev Mehta Nov 27 '14 at 04:32
  • 1
    Note that "Chinese ASCII" concept does not exist - there are several encoding that support Chinese characters, but ASCII (essentially 7bit encoding with Latin letters) is not one of them. Link found by @RajeevMehta gives you steps to follow - if you still have problem vote/comment to reopen or ask new question. Make sure to clearly specify what works, what you get and also what actual encoding is hiding behind "Chinese ASCII" name. – Alexei Levenkov Nov 27 '14 at 04:40

0 Answers0