1

I am trying to get a text input field whose value gets sent as the parameter for an XSL transformation which is performed in JavaScript. I have set up a form with the get method, and my script gets the URL parameter like this:

var word=unescape((''+self.location.search).substring(5)).toLowerCase();

This works fine, except when the input contains special characters. I have set the HTML page's encoding to UTF-8, and I have added

accept-charset="utf-8"

to the form. I have also specified charset="utf-8" in the script tag, but it still doesn't work. My browser (Firefox) is set to UTF-8 as the default encoding. I have tried removing the unescape function too.

1 Answer 1

5

try

decodeURIComponent()

instead of

unescape

see @ http://www.w3schools.com/jsref/jsref_decodeuricomponent.asp

Sign up to request clarification or add additional context in comments.

1 Comment

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.