繁体   English   中英

C#如何从UTF-8字符串中检索原始字符串?

[英]C# How to retrieve an original string from the UTF-8 string?

在我的页面上,我设置了UTF-8编码。 然后,将由encodeURIComponent()函数编码的字符串“ ły ”发送到%C5%82y ,在服务器端,我得到%25C5%2582y 现在我想找回原始字符串。

我试过了:

HttpUtility.HtmlDecode(): the result is %25C5%2582y
Uri.UnescapeDataString(): the result is %C5%82y

我现在很困惑-如何找回原始字符串?

使用HttpUtility.UrlEncode编码和HttpUtility.UrlDecode解码。

Uri.UnescapeDataString(HttpUtility.UrlDecode("ły"));

做到了

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM