Hi all,

I feel incredibly inept for even asking this question, but I can't find a solution. I have an application that widely uses single quotes for tag attributes, which is perfectly valid XHTML, eg:
<input type='text' name='surname' value='French' />


However, I can't find a way of escaping a single quote inside the attribute, which is causing problems with surnames which have an apostrophe, eg:
<input type='text' name='surname' value='O'Riley' />


My first reaction (after years of PHP scripting) was to escape it with a slash:
<input type='text' name='surname' value='O\'Riley' /> -- doesn't work.


My next step was to replace it with an entity, but there isn't one (apart from &#145;, which seemed to cause problems later).


The simple answer seems to be use double quotes for all attributes, so that at least the nested double quotes can be replaced with a &quot; entity, but I can't believe this is my only option -- am I missing something??????


---
Justin French
http://indent.com.au

*****************************************************
The discussion list for http://webstandardsgroup.org/
See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list & getting help
*****************************************************




Reply via email to