...

View Full Version : encodeURIComponent behaves differently in browsers for china as location



frozene4
10-11-2011, 07:49 AM
i have an interesting problem in hand that involves chinese..

i use google custom search and append searched keywords as below..

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


results in chrome and internet explorer for 搜索 are proper but in firefox no results appear..
in chrome and internet explorer, url created is http://search.xyz.com/search/cn/zh#%E6%90%9C%E7%B4%A2
in firefox, url created is http://search.xyz.com/search/cn/zh#%u641C%u7D22
in chrome and internet explorer, search box that appears in the result page has value 索
in firefox, search box that appears in the result page has value 搜索
in all three browsers, if i search with any valid chinese words, no result appear..


i do include below elements in the file..


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


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

since the query is formed in the browser using script, my tomcat server is not involved, so we can rule that out..

now how do i show 搜索 in search box in result page of chrome and internet explorer and also achieve the search with valid chinese words..

highly appreciate your help..



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum