Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Advanced question (escape and encodeURI)

Status
Not open for further replies.

Rydel

Programmer
Feb 5, 2001
376
CZ
I am trying to solve this scheise problem for two days already! It's about proper handling of Cyrillics on (namely, in the search URL). Previously I have used JavaScript's escape() function in a similar situaiton. With escape non-ASCII characters and special symbols are converted into a %nn format, where n is a hexadecimal digit. The problem is that escape() doesn't convert Unicode characters properly. IE does support Unicode, but escape() generates a %unnnn format which is not what is expected by many applications (in my case Google and Amazon).

The almost perfect solution is to use encodeURI() function, the new addition to IE5.5+ and Netscape 6+. It does exactly what I want. Now I need to figure what to do with the older browsers such as IE5.0 and Netscape 4. I wonder if anybody has written JavaScript function that does this encoding?

PS. Another problem I ran into, is that somehow Cyrillics also get screwed in the ASP page even though I have the appropriate directive on top of the page:

<%@CODEPAGE=1251%>
<%Session.Codepage=1251%> ---
---
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top