How to convert a string containing escape characters to a string

前端 未结 4 2232
心在旅途
心在旅途 2020-12-11 19:25

I have a string that is returned to me which contains escape characters.

Here is a sample string

\"test\\40gmail.com\"

A

4条回答
  •  忘掉有多难
    2020-12-11 19:39

    The sample string provided ("test\40gmail.com") is JID escaped. It is not malformed, and HttpUtility/WebUtility will not correctly handle this escaping scheme.

    You can certainly do it with string or regex functions, as suggested in the answers from dasblinkenlight and C.Barlow. This is probably the cleanest way to achieve the desired result. I'm not aware of any .NET libraries for decoding JID escaping, and a brief search hasn't turned up much. Here is a link to some source which may be useful, though.

提交回复
热议问题