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 10:10:53 -0500 (EST)
Message-Id: <200101251510.PAA10062@inputplus.demon.co.uk>
To: www-html@w3.org

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

    'a double " quote'
    "a single ' quote"
    'don't &#34; care &#39; what'
    "don't &#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
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 Monday, 29 January 2001 16:46:41 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:15:45 GMT