Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

"ZERO WIDTH NO-BREAK SPACE foobar No width (the character is invisible)"

Time to insert this into some of my friends code.



I've actually joked with colleagues about this, and often it doesn't work. Try using the U+FEFF in Javascript, in Chrome it's taken as a space (but the console will mark it as a red circle, not an invisible no-width character), and Firefox refuses to even allow it to be entered.

You can also use a character and combining character to make a symbol that looks exactly like a semicolon, but technically isn't. Browsers treat it as a semicolon anyways. I wanted to be able to do `var ; = "foobar";`

Maybe it will sneak by other languages that allow unicode in the code? Though I don't know of many.


I've had problems with code having non-ASCII spaces appended, and the terminal rendering them as zero-width, so I had to use hexdump to find the problem.


Also fun are left-to-right and right-to-left marks.


This is a level of evil I hadn't considered.


As Seen in Production™




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: