is it possible to convert a string like "\u00e8" (Got it by reading a WebRequestResponse with Streamreader) to it's unicode char(è)? Tried many things with Encoding, but nothing works.
Asked
Active
Viewed 1,450 times
2
-
1Please show us what you've tried, so we don't offer solutions that have already not worked for you. – Sep 21 '16 at 15:06
-
1Can you show how the code, best done in an [mcve], you *tried* to set the encoding? – rene Sep 21 '16 at 15:07
-
1Presumably this text is part of something else - is it JSON? If so, just use a JSON parser... – Jon Skeet Sep 21 '16 at 15:08
-
I've tried using every available Encoding at 'new StreamReader(dataStream, Encoding.
)' Yes it is JSon, also tried HttpUtility.JavaScriptStringEncode(Source), but it also doesn't do what i want – Sep 21 '16 at 15:15
1 Answers
2
You can use Regex.Unescape()
, which unescapes any escape sequences that are valid for a Regex (including \uXXXX
). Note that it also unescapes other sequences like \t
, \n
, and \[
.

Mark Cidade
- 98,437
- 31
- 224
- 236
-
-
1Two downvotes and absolutely no explanation. Can someone clue me in here? I also found the following: http://stackoverflow.com/a/31362213/2524589 They suggest using System.Uri.UnescapeDataString(string) – KSib Sep 21 '16 at 15:18