Question

I have a form element such as: <input type="text" value="O&rsquo;Reilly" />

But when this form is submitted, the value passed to the form handler is decoded and the ’ character is sent instead of the original string &rsquo;

I need to get the original string in it's literal/raw form, but I cannot seem to force the page to stop decoding these HTML elements for me. Any ideas?

Was it helpful?

Solution

HTML-encode the ampersand with &amp; to prevent it from being part of an escape sequence: <input type="text" value="O&amp;rsquo;Reilly" />

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top