开发者

URL with Cyrrilic querystring not working in IE (but working in Firefox)

开发者 https://www.devze.com 2023-01-29 06:37 出处:网络
On our site, I use the category (in Russian) in the querystring. E.g.: 开发者_Python百科http://www.odinklik.ru/kategoriya.aspx?cat=люди

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

E.g.: 开发者_Python百科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#)


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.


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

0

精彩评论

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