Re: [VE][122] Smart quotes not allowed in the value of attribute "id"

Dan Dascalescu wrote:

> I was validating the following XHTML 1.0 Strict fragment:
>
> <h1 id="&#8220; &#8221;">header text</h1>
>
> and got the error that the "smart" quotes were not allowed.

That is correct, though the error message is differently formulated.

> I'm
> curious as to why that is, since smart quotes are high-ASCII Unicode
> characters like any other,

There is no such thing as high-ASCII, unless you mean octet 7F (hexadecimal) 
and below, and "smart" quotes aren't there.

> and hex-encoded Chinese characters (e.g.
> &#x884C;) are perfectly allowed in 'id' attribute values.

The character U+884C, whether as such or as a character reference, is 
classified as a letter, for the purposes of XML syntax at least. Here's an 
excerpt from XML spec:
Ideographic    ::=    [#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029]

The "smart" quotes aren't letters under any definition, and they aren't 
allowed in identifiers in XML by any other rule either. Why _would_ you use 
quotation marks in an identifier?

Generally, it is surely safest to stick to good old ASCII letters (and maybe 
a few other ASCII characters as allowed by old HTML specs) in identifiers. 
After all, identifiers are supposed to be machine-processable mainly, not 
something that end users see (though they may accidentally see them e.g. 
when an identifier appears in a link in a fragment identifier).

-- 
Yucca, http://www.cs.tut.fi/~jkorpela/ 

Received on Friday, 21 November 2008 18:24:28 UTC