encodeURIComponent在中国作为位置的浏览器中表现不同

时间:2011-10-10 16:35:58

标签: javascript internet-explorer firefox google-chrome encodeuricomponent

我手头有一个涉及中文的有趣问题..

我使用谷歌自定义搜索并附加搜索关键字如下..

window.location="http://search.xyz.com/search/cn/zh"+"#"+encodeURIComponent(searchedKeywords);

  1. 导致搜索的chrome和Internet Explorer是正确的,但在firefox中没有显示结果..
  2. Chrome和Internet Explorer中的
  3. ,创建的网址为http://search.xyz.com/search/cn/zh#%E6%90%9C%E7%B4%A2
  4. 在firefox中,创建的网址为http://search.xyz.com/search/cn/zh#%u641C%u7D22
  5. Chrome和Internet Explorer中的
  6. ,结果页面中显示的搜索框具有值æç'¢
  7. 在firefox中,结果页面中显示的搜索框具有值搜索
  8. 在所有三种浏览器中,如果我搜索任何有效的中文单词,则不会显示任何结果..
  9. 我确实在文件中包含以下元素..

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <meta http-equiv="Content-Language" content="zh-CN" />

    由于查询是在浏览器中使用脚本形成的,因此我的tomcat服务器不参与,所以我们可以将其排除在外..

    现在如何在chrome和Internet Explorer的结果页面的搜索框中显示搜索,并使用有效的中文单词进行搜索..

    非常感谢您的帮助..

0 个答案:

没有答案