W3C home > Mailing lists > Public > www-html@w3.org > January 2001

Character Entity Reference for Single Quote.

From: Ralph Corderoy <ralph@inputplus.demon.co.uk>
Date: Thu, 25 Jan 2001 22:44:49 +0000
Message-Id: <200101252244.WAA22519@inputplus.demon.co.uk>
To: www-html@w3.org


WRT Section 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, &#34; and &#39; can be
used without regard for the quotes used.

    'a double " quote'
    "a single ' quote"
    'dont &#34; care &#39; what'
    "dont &#34; care &#39; what"

Finally, &quot; 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

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.


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

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:05:56 UTC