URL with Cyrrilic querystring not working in IE (b

2019-06-05 13:59发布

On our site, I use the category (in Russian) in the querystring.

E.g.: http://www.odinklik.ru/kategoriya.aspx?cat=люди

If you paste this link in IE8, it is translated to cat=???? and it does not work If I paste it in FireFox, it works.

It gets even more weird: the same URL is reachable from the homepage, and if I click the same URL in IE8 from the homepage it works fine (unless I click open in a new tab, that it is back to ????).

I am using ASP.NET 3.5(C#)

2条回答
贼婆χ
2楼-- · 2019-06-05 14:14

You should URL-encode the category name before adding it to the querystring, rather than relying on the browser to do that for you.

The method HttpServerUtility.UrlEncode should be able to handle this encoding for you.

HttpServerUtility.UrlEncode should give you the link http://www.odinklik.ru/kategoriya.aspx?cat=%D0%BB%D1%8E%D0%B4%D0%B8, which should give you the correct result.

(Note that %D0%BB corresponds to л, %D1%8E to ю, %D0%B4 to д and %D0%B8 to и. As the Unicode values for Cyrillic characters are over U+ff, you will require two URL-encoding bytes for each character.)

查看更多
Fickle 薄情
3楼-- · 2019-06-05 14:25

Did you try to do encoding on first page and decode from Cyrillic to Unicode and back? Little bit a headache but surly will work.

查看更多
登录 后发表回答