0

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?

1 Answer 1

1

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

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

1 Comment

that doesn't help if the value is determined by the user. Seems rather odd that decoding happens when a form is submitted it should just send the value and do nothing to it.

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.