J
John J. Hughes II
I have enable Thai language support on English WinXP Pro SP1 via the IME.
I have an old application where I enter the Thai data on a form and then
save it to the SQL server as varchar. This works fine in of itself.
Now I have a C# application that needs to read it. I get garbage.
I am trying to determine how to change the encoding from the one format to
the other and part of the problem is I don't know what the two formats are.
Any suggestions? I am pretty sure Excel wants UNICODE and it's in two byte
something.
///////////////////////////////
One of many version of code I have tried:
Encoding a = Encoding.UTF7;
Encoding u = Encoding.UTF8;
Decoder d = Encoding.UTF7.GetDecoder();
byte[] aBytes = a.GetBytes((string)dr["Location"]);
char[] c = new char[aBytes.Length];
d.GetChars(aBytes, 0, aBytes.Length, c, 0);
string uStr = new string(c);
oSheet.Cells[row, 8] = uStr;
Regards,
John
I have an old application where I enter the Thai data on a form and then
save it to the SQL server as varchar. This works fine in of itself.
Now I have a C# application that needs to read it. I get garbage.
I am trying to determine how to change the encoding from the one format to
the other and part of the problem is I don't know what the two formats are.
Any suggestions? I am pretty sure Excel wants UNICODE and it's in two byte
something.
///////////////////////////////
One of many version of code I have tried:
Encoding a = Encoding.UTF7;
Encoding u = Encoding.UTF8;
Decoder d = Encoding.UTF7.GetDecoder();
byte[] aBytes = a.GetBytes((string)dr["Location"]);
char[] c = new char[aBytes.Length];
d.GetChars(aBytes, 0, aBytes.Length, c, 0);
string uStr = new string(c);
oSheet.Cells[row, 8] = uStr;
Regards,
John