W3C home > Mailing lists > Public > www-style@w3.org > November 2007

Re: Where are unicode escapes allowed?

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Thu, 08 Nov 2007 15:52:53 +0100
To: Christof Hoeke <csad7@t-online.de>
Cc: www-style@w3.org
Message-ID: <k886j3p217mpk2uju2cjo5ps1bp3nfssbp@hive.bjoern.hoehrmann.de>

* Christof Hoeke wrote:
>http://www.w3.org/TR/css3-syntax/#referring 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 
>http://www.w3.org/TR/css3-syntax/#tokenization) 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 · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 
Received on Thursday, 8 November 2007 14:53:01 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:31 UTC