This content has been marked as final.
Show 2 replies
-
1. Re: Special Character Handling
insuractive Nov 27, 2011 7:25 PM (in response to Phinehas1234)You'll need to use a JavaScript string replace() method (or a similar equivalent) in order to do that since your code is being executed client side rather than server side. Replace it with its corresponding URL encoded value (%26)
-
2. Re: Special Character Handling
Adam Cameron. Nov 28, 2011 12:19 AM (in response to insuractive)I know the above answer has been marked as "correct", but I'm afraid it's not the best way of going about things, nor is it complete.
There are more characters the user could potentially enter which will cause problems here than just ampersand. Fortunately this possibility was predicted by the JavaScript bods, so there's a function to deal with it: encodeURIComponent():
http://www.w3schools.com/jsref/jsref_encodeuricomponent.asp
That is what should be being used in these situations.
--
Adam


