开发者

QueryString encoding of non-ANSI characters in ASP.Net

开发者 https://www.devze.com 2023-01-01 20:20 出处:网络
I\'m passing \"Malmö\" as a Request.QueryString parameter to a page. However, the code sees it as \"Malm�\" meaning that s开发者_运维百科tring comparison fails. All globalization settings are set to

I'm passing "Malmö" as a Request.QueryString parameter to a page. However, the code sees it as "Malm�" meaning that s开发者_运维百科tring comparison fails. All globalization settings are set to UTF-8 in web.config. Am I missing something?

Edit: The querystring looks like this http://localhost/PageName/?courseKommun=Malm%F6


%F6 is not the URL encoding for ö, that's why you don't see an ö.
The correct URL encoding would be %C3%B6 (see).

It should work just fine with both versions:

  • /?courseKommun=Malmö
  • /?courseKommun=Malm%C3%B6
0

精彩评论

暂无评论...
验证码 换一张
取 消