Question

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.

Was it helpful?

Solution

call:

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

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

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top