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

Where are unicode escapes allowed?

From: Christof Hoeke <csad7@t-online.de>
Date: Thu, 08 Nov 2007 15:37:45 +0100
Message-ID: <47331F39.7090308@t-online.de>
To: www-style@w3.org

hello,
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:

.x1, .x2, .x3 { color: red; }

/* normal: */
.x1{color:#0a0}

/* .x2{color:#0a0} fully escaped: */ 
\00002e\000078\000032\00007b\000063\00006f\00006c\00006f\000072\00003a\000023\000030\000061\000030\00007d

/* .x3{color:#0a0} partly escaped - not the css special chars: */ 
.\000078\000033{\000063\00006f\00006c\00006f\000072:#\000030\000061\000030}

(see testpage at http://cthedot.de/cssutils/test.html)

Only .x1 and .x3 are green in FF2, IE6+7 (IE5.01-5.5 but also the newest 
Opera 9.24 do not recognize .x2 either).


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).

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?

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:

'IDENT',
'ATKEYWORD' (plus all the specific ones defined in CSS2.1),
'STRING',
'INVALID' (only defined in CSS2.1 yet),
'HASH',
'DIMENSION',
'URI',
'COMMENT'
'FUNCTION',

Or is even this too comprehensive as even Opera fails to recognize .x2 
as a valid rule?

thanks
Chris
Received on Thursday, 8 November 2007 14:38:13 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:56 GMT