Character Entity Reference for Single Quote.

Hi,

WRT Section 5.3.2.

    http://www.w3.org/TR/html4/charset.html#h-5.3.2

Attribute values can be surrounded by single or double quotes.  A
single quoted string can contain double quotes and vica versa.
Alternatively, their ASCII codes can be used, " and ' can be
used without regard for the quotes used.

    'a double " quote'
    "a single ' quote"
    'dont " care ' what'
    "dont " care ' what"

Finally, " is a character entity reference for double quote.

Forgive me, but my i18n knowledge is poor.  I've been talking with
someone who has Perl code for escaping text prior to inserting into a
HTML attribute.  The four characters [<>&"] are replaced by their
character entity references, e.g. &quot;.

I've argued that a single quote should also be substituted by &#39;
since the escaped text may be placed into a single quoted attribute
value.

This is accepted by the other party but they say the code could only do
this if it knows the character set is ISO-8859-1 otherwise character
code 39 might be something different.

So, my question is it valid to always use &#39; in all the situations
where &quot; is valid?  If so, using &#39; won't break the code any
more than it might possibly already be broken.  If not, then shouldn't
there be a &squot; character entity reference so code can work without
knowing the value of the character?

BTW, I'm not a subscriber having found a pointer to the list but no
subscription details so please keep me CC'd on this.

Thanks,


Ralph.

Received on Thursday, 25 January 2001 17:44:58 UTC