jquery-encoder icon indicating copy to clipboard operation
jquery-encoder copied to clipboard

Support astral symbols in `encodeForCSS`

Open mathiasbynens opened this issue 12 years ago • 0 comments

Testing on http://rawgithub.com/chrisisbeef/jquery-encoder/master/site/index.html shows that invalid/incorrect CSS escape sequences are generated for astral symbols:

$.encoder.encodeForCSS('\uD834\uDF06'); // U+1D306 TETRAGRAM FOR CENTRE; GitHub won’t let me use the raw symbol here
// → '\\d834 \\df06 ' which is incorrect
// it should be: '\\1d306 '

Some more info here: http://mathiasbynens.be/notes/css-escapes#other

A robust library for escaping text for use in CSS is: http://mths.be/cssesc Feel free to use it as a dependency for this project.

mathiasbynens avatar Aug 23 '13 11:08 mathiasbynens