Skip to content

Instantly share code, notes, and snippets.

@tim545
Last active August 11, 2019 14:51
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tim545/ebe53633e7be4f9200ec to your computer and use it in GitHub Desktop.
Save tim545/ebe53633e7be4f9200ec to your computer and use it in GitHub Desktop.
The most evil character in Unicode

'Zero Width Space' character

I had some trouble with this character in a client project, it was hidden inside a configuration string which is validated in the clients API. It's basically invisible, literally a space character with zero width, it could not be seen but it was breaking at the API because it would not validate, causing problems with hundreds of user accounts.

The Unicode value of this character is U+200B, and it's evil, very evil. Lying in wait to break your applications while leaving no sign of it's presence...

It also has some friends, check the answer of this Stack Overflow question

In my project, it was one of my colleuges who managed to find the character, he re-copied the string into the code and Git showed that the line had been changed, even though all the Git GUI's didn't actually show any difference. He ran git diff in the command line and this did show the Unicode character being deleted, that's something worth noting, Github and his Git client did not show the character but git diff did.

For me I relaised that one my beloved Sublime text (3) plugins had failed to show this character, I had one installed which was designed to do just that. I looked it up and found that it didn't seem to be supported anymore so I forked it and added the zero width space character so that it would now show as a red pipe |, still not so easy to spot but it's something. My package is not on package control but you can install it maunally - https://github.com/tim545/highlight-unicode-characters, it's easy to do. This version has all the pull requests of the last one implimented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment