且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在URL解码外语字符

更新时间:2023-02-23 11:57:07

您应该使用的 HttpUtility.UrlDe $的C $ C()接受编码过载:

You should use an overload of HttpUtility.UrlDecode() that accepts an encoding:

HttpUtility.UrlDecode("%F3", Encoding.GetEncoding("ISO-8859-1"))

此假设它实际上是使用ISO-8859-1编码。如果使用Windows 1250,您应该使用。 (这两个都非常相似,但它们是不相同的。)

This assumes it actually is using the ISO-8859-1 encoding. If it uses Windows-1250, you should use that. (These two are very similar, but they are not the same.)