Possible Duplicate:
Converting Unicode strings to escaped ascii string
How can I convert ä...
into something like \u0131...
?
is there any Function for doing this ?
p.s :
beside this way : [ sorry @Kendall Frey :-)]
char a = 'ä';
string escape = "\\u" + ((int)a).ToString("X").PadLeft(4, '0');
Here's a function to convert a char to an escape sequence:
string GetEscapeSequence(char c)
{
return "\\u" + ((int)c).ToString("X4");
}
It isn't gonna get much better than a one-liner.
And no, there's no built-in function as far as I know.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With