A current problem
I recently came across this question on Stack Overflow where the OP was convinced that Java's String class was broken. They were comparing two string literals which looked 100% identical to the human eye, however, one of the strings had a zero-width space character at the beginning. This meant that the lengths of the strings varied by 1 in an extremely confusing manner.
Even when going into the Edit Question section, the character is completely invisible (which makes sense, since it's a control character in a raw textarea). The only way for me to see this character, is by copying the code snippet and pasting it into my own text editor, where it is nicely highlighted in red.
Screenshot from my text editor:
Potential pranks
Since this character is currently completely invisible, people could write some nasty pranks that convince people a language is completely broken.
For example, consider this JavaScript snippet:
// Strings in javascript are broken!!!
const s = "hi";
console.log('The length of "%s" is: %d', s, s.length);
// The length is 6?! Javascript must suck!
It looks pretty convincing, right?
This kind of thing could have people scratching their heads for hours. Whereas, if the characters were highlighted, it would be instantly noticeable.
Summary
I think that highlighting zero-width space characters in red (or any other colour, for that matter) would be a useful addition to Stack Overflow.
It's not a huge problem, but it could save a lot of time and confusion.
What do you think?
\ufeff
). The ability to show these would be useful, but I would make it a toggle, as it’s possible some monospaced blocks (like program output) might actually want the true nonprinting behavior.‌
(zero-width non-joiner - effectively Unicode U+200C) to get only part of a word formatted in italics (unnecessary in that case). Revision 1. I far as I know, such HTML tags are ignored.