Hi folks! My JS function takes the (text) value of a drop-down list and dynamecliy create a link which looks something like that: …?name=%D7%97%D7%99%D7%A4%D7%95%D7%A9+%D7%91… It works fine. Whoever if the passed text contains apostrophe, commas or hyphen it doesn't work because it will 'copy' the string until it hits those spcial chars. What to do!
You can trey using the escape() function and then further special characters are encoded using a routine simmilar to: function encodeMyHtml() { encodedHtml = escape(encodeHtml.htmlToEncode.value); encodedHtml = encodedHtml.replace(/\//g,"%2F"); encodedHtml = encodedHtml.replace(/\?/g,"%3F"); encodedHtml = encodedHtml.replace(/=/g,"%3D"); encodedHtml = encodedHtml.replace(/&/g,"%26"); encodedHtml = encodedHtml.replace(/@/g,"%40"); encodeHtml.htmlEncoded.value = encodedHtml; } Code (markup): Although you can use the encodeURI() instead or escape() because "the escape and unescape functions do not work properly for non-ASCII characters and have been deprecated". That phrase is from: http://developer.mozilla.org/en/doc...fined_Functions:escape_and_unescape_Functions
Hi, I need to replace the ' -' and ' " ' with something like %D4 or %F5 or whatever So can you tell me where I can find to full chars table? TKS,
You can find it here: http://www.asciitable.com/ with values in: decimal, hexadecimal, octal, character, and html entities.