I have created a function to convert hex to utf16. It works with english letters, but I also need it to work with international letters.
Example hexString=4A006F007200640065006E005F006D00E5006E0065007200000000000000 gives Jorden_m"ner, but I want it to give me Jorden_måner
- public String hexToUTF16(String hexString)
- {
- int length = hexString.Length;
- byte[] bytes = new byte[length / 2];
-
- for (int i = 0; i < length; i += 2){
- bytes[i / 2] = Convert.ToByte(hexString.Substring(i, 2), 16);
- }
-
- char[] chars = Encoding.UTF8.GetChars(bytes);
-
- string s = new string(chars);
- s = s.Replace("\0", string.Empty);
- return s;
- }