WebKit CSS content Unicode bug?

This is a bug in WebKit that only got fixed recently (in April 2012).

To paraphrase my write-up on escape sequences for CSS identifiers:

In theory (as per the spec), any character can be escaped based on its Unicode code point (e.g. for 𝌆, the U+1D306 “tetragram for centre” symbol: \1d306 or \01d306), but older WebKit browsers don’t support this syntax for characters outside the BMP.

Because of browser bugs, there is another (non-standard) way to escape these characters, namely by breaking them up in UTF-16 code units (e.g. \d834\df06), but this syntax (rightfully) isn’t supported in Gecko ++and Opera 12++.

Since there is currently no way to escape non-BMP symbols in a cross-browser fashion, it’s best to just use these characters unescaped.

In your case, the U+1F4A1 character is a supplementary (non-BMP) symbol. All other symbols are BMP characters, so those aren’t affected by the bug.

I’ve also made a tool to help you with CSS escapes, and it warns you if you enter a non-BMP character:

Leave a Comment