Decoding foreign language characters in url

前端 未结 1 948
梦毁少年i
梦毁少年i 2020-12-22 05:43

I am decoding characters in a URL by using HTTPUtility.URLDecode. Here are the characters I have to decode:

%26 = \"&\"
%28 = \"(\"
%29 = \")\"
%20 =

相关标签:
1条回答
  • 2020-12-22 06:34

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

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

    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.)

    0 讨论(0)
提交回复
热议问题