I have a function that inserts some text into a textarea. The text is a placeholder for some data merging, and looks like %%FieldName%%. I have run into an issue where when i insert the text %%FaxNumber%%, it inserts it as '%úx Number%%'.
I've done a few tests which rules out the function, but seems the issue is with the parameter to the function. If i pass '%Fa' it converts it to ú. Is there anyway i can stop this from happening??
To test this, in a blank html document add the line:
<a href="javascript:alert('%Fa');">test</a>
You will be prompted with 'ú'. There is no doctype, im using quirks mode (to take advantage of 100% height).
There is no doctype, im using quirks mode (to take advantage of 100% height)
You should not work in quirks mode, to take advantage of the strict standard coding. It is well known that browsers act unforeseeable in quirks mode, this is the reason for a DTD is required.
Kor:
Meta charset is UTF-8. This is an older app i've taken over and will be putting into a new template, with a DTD!
thraddash:
The only problem with escaping the string is it ends up being URL encoded, so the example field name ends up as '%25%FaxNumber%25%25', which doesn't quite do it.
So i really dont understand why its encoding, even with a DTD and encoding specified!
I could modify it to use the onclick event instead of javascript: on the a tag (with href="#"), but i've had some issues with that in the past where some browsers execute the onclick but nav to blank page. Returning false (like on a submit button to cancel a form post) doesn't always work.
I'd just like to know why its encoding it. I suppose it is in the href attribute, and the javascript: just tells the browser to run the script as the URI instead of http reference. I suppose it is a URL and thus URL encoding!?!
Bookmarks