如何解码如下字符串:
name1=ABC&userId=DEF&name2=zyx&payload=%3cSTAT+xmlns%3axsi%3d%22http%3a%2f%2fwww.w3.org%2f2001%2fXMLSchema-instance%22%3e%3cREQ...
背景:我正在接受 HTTP POST(基本上是名称值对),然后将字节数组转换为字符串:
Encoding.UTF8.GetString(response, 0, response.Length);
我已经尝试了 WebUtility 和 HttpUtility 的 HtmlDecode 方法,但似乎得到了相同的字符串。
最佳答案
这应该为您完成工作:
System.Uri.UnescapeDataString(str)
关于c# - 解码百分比编码的字符串 c# .net,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12898556/