Unicode literals

67 views
Skip to first unread message

Joshua Kifer

unread,
Jul 22, 2013, 10:36:12 AM7/22/13
to lives...@googlegroups.com
I'm trying to build a string with a CSS unicode literal (\0027), but when constructing this string, livescript coerces it to a javascript unicode literal (\u00027).

How can I build a string with the pure text '\0027' in it?  That is I want exactly those 5 characters in the string without any coercion or interpolation.

Joshua Kifer

unread,
Jul 23, 2013, 8:34:36 AM7/23/13
to lives...@googlegroups.com
Bump.  George can you or anyone speak to this?  The only alternative I can think of is to write these characters out separately without constructing a string, but that is going to be tedious.

George Zahariev

unread,
Jul 23, 2013, 3:25:34 PM7/23/13
to lives...@googlegroups.com
I may be misunderstanding what you want, but here's a shot...
In JavaScript, the string "\0027" evaluates to the string "7". If you want a string to evaluate to "\0027", you must write "\\0027" in JavaScript.
Thus in LiveScript, if you want a string to evaluate to "\0027", we must compile to "\\0027", which is what "\\0027" in LS compiles too.

Joshua Kifer

unread,
Jul 23, 2013, 3:34:16 PM7/23/13
to lives...@googlegroups.com
Well I feel stupid.  I was using the repl and I was being echoed back the js representation.  If I console.log it comes out right.  This is not an issue, I humbly apologize.
Reply all
Reply to author
Forward
0 new messages