Re: Where are unicode escapes allowed?

* Christof Hoeke wrote:
> defines how characters not 
>allowed in the current encoding may be put in a stylesheet anyway. It is 
>also said to use this escape facility only if needed. But theroretically 
>(maybe for obfuscation purposes) it may be used to extremes:

At the moment you are better off with the CSS 2.1 syntax and grammar
documents; escapes are allowed as part of identifiers, strings, the
url(...) notation and the #... notation and perhaps other features
outside CSS 2.1.

>/* .x2{color:#0a0} fully escaped: */ 

This would be parsed as single identifier, escaping special chars
like the curly braces removes their special meaning, so the rule
has no declaration block.

>I guess using unicode escape sequences for special CSS characters like 
>., #, {, : }, etc generally escape theses characters as well (I could 
>not find the spec page but remember reading this somewhere).

This is implicit by the way you parse the escapes which is largely
determined by where they are allowed.

>The result would be: Unicode escape normalization (meaning using the 
>actual chars) can only happen *after* the tokenization is done and not 
>on the raw css text?

That is correct. Think about escaping " and ' inside a string literal,
if you remove them before parsing, the style sheet would be malformed.

>Could one define a list of Tokens (defined at 
> for which escapes are 
>possible? Would the following list be correct and complete:

You can simply take the generic syntax as defined in CSS 2.1 and
track where 'escape' is allowed. That would give you all the rules.
Björn Höhrmann · ·
Weinh. Str. 22 · Telefon: +49(0)621/4309674 ·
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · 

Received on Thursday, 8 November 2007 14:53:01 UTC