views:

186

answers:

2

Hi all,

I am trying to make my web app compatible with international languages and I am stuck with trying to convert escaped characters in my Delphi .NET DLL.

The front end code is passing the UTF-8 hex notation with an escape character e.g for お I pass \uE3818A. In my DLL I capture this and constract the following string '$E3818A'. I need to convert this back to お and send it to my database, I've been trying to use Encoding.UTF8.GetBytes and Encoding.UTF8.GetString but with no luck.

Anyone could help me figure this out?

Thank you.

+1  A: 

Turn your string into a byte array representing the original bytes (in this case 0xE3, 0x81, 0x8A), and then call Encoding.UTF8.GetString(bytes) - that should be fine.

Jon Skeet
Thanks you for pointing me to the right direction!
Evan V.
A: 

call:

byte.Parse("12", NumberStyles.HexNumber);

on every to characters and store into byte[], then call Encoding.UTF8.GetString(byteStr)

Andrey
Thanks, that worked fine for £, carriage return and German! I still can't get Japanese or Greek characters to work, but I will worry about that later. Thanks again.
Evan V.
if you accept my answer please click accept :)
Andrey