带有 Cyrrilic 查询字符串的 URL 在 IE 中不起作用(但在 Firefox 中起作用)

发布于 2024-10-06 10:18:52 字数 379 浏览 0 评论 0原文

在我们的网站上,我在查询字符串中使用类别(俄语)。

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

如果您在 IE8 中粘贴此链接,它会被翻译为 cat=????它不起作用 如果我将它粘贴到 FireFox 中,它就可以工作。

更奇怪的是:可以从主页访问相同的 URL,如果我在 IE8 中从主页单击相同的 URL,它可以正常工作(除非我单击在新选项卡中打开,否则它会返回???) 。

我正在使用 ASP.NET 3.5(C#)

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

遮云壑 2024-10-13 10:18:52

您是否尝试过在第一页上进行编码并从西里尔字母解码为 Unicode 并返回?
有点头疼,但肯定会起作用。

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.

请远离我 2024-10-13 10:18:52

您应该在将类别名称添加到查询字符串之前对其进行 URL 编码,而不是依赖浏览器为您执行此操作。

方法 HttpServerUtility.UrlEncode 应该能够为您处理此编码。

HttpServerUtility.UrlEncode 应该为您提供链接 http://www.odinklik.ru/kategoriya.aspx?cat=%D0%BB%D1%8E%D0%B4%D0%B8,这应该会给你正确的结果。

(注意%D0%BB对应于л%D1%8E对应于ю% D0%B4д%D0%B8и 因为西里尔字符的 Unicode 值超过 。 U+ff,每个字符需要两个 URL 编码字节。)

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文