Wednesday, March 9, 2011

Convert unicode in hex

 string str = "युवराज फिर बने भारत की जीत के नायक"; //unicode text

        string data= string.Empty;  //for high performance
        foreach (char ch in str)
        {
            int temp= ch;
            data+= String.Format("{0:x4}", (uint)System.Convert.ToUInt32(temp.ToString()));
        }
        data= data.ToUpper();

0 comments:

Post a Comment