logoalt Hacker News

Aozora7 • yesterday at 1:21 PM • 6 replies • view on HN

My favorite unicode character is zero width space. One of its funniest properties is that it's not a whitespace.

Also, some programming languages treat it as a valid identifier.


Replies

eviks • today at 8:08 AM

That's new

> For example, U+200B ZERO WIDTH SPACE was originally classified as a space character (General_Category=Zs), but it was reclassified as a Format character (General_Category=Cf) to clearly distinguish it from space characters in its function as a format control for line breaking.

nickcw • yesterday at 6:36 PM

Ha! Yes I discovered that this is true in C as part of my IOCCC entry:

https://github.com/ioccc-src/winner/blob/master/2025/ncw3/pr...

gucci-on-fleek • today at 3:18 AM

Braille Pattern Blank "⠀" (U+2800) is another one of my favourites, since it's also not considered whitespace, but it looks like it. It can actually be fairly helpful for forms that won't let you leave any field blank, since it bypasses most whitespace checks.

➕ show 1 reply
Rendello • yesterday at 7:07 PM

I use it for sites like Facebook where I want to type :) without it changing to the terrible `U+1F642 SLIGHTLY SMILING FACE` [1]. I wouldn't really mind if it were the `U+1F60A SMILING FACE WITH SMILING EYES` [2], but the first one is so laughably terrible, as if I'd really want to send an emoji to communicate a disingenuous, pained smile as a default. Some platforms let you backslash-escape sequences so they don't get turned to emoji, like \:), but for Facebook and the like, putting a ZWS in between the letters stops the conversion.

Though if your emoji is at the end of a line, it'll potentially break your emoji between the two lines. since That's what a ZWS is for, after all.

1. https://util.unicode.org/UnicodeJsps/character.jsp?a=%F0%9F%...

2. https://util.unicode.org/UnicodeJsps/character.jsp?a=1F60A&B...

➕ show 3 replies
TacticalCoder • yesterday at 2:18 PM

> My favorite unicode character is zero width space. One of its funniest properties is that it's not a whitespace.

My editor is configured to never show any character (except the one and proper newline) at less than the full-width of a regular character (in the monospace font I'm using ofc).

And if it's not a visible ASCII char, not only it's always shown at least at full-width, it's also shown as bold magenta on a black background. As the non visibe zero-width is empty, it shows as full-width on a black background.

Sticks out like a sore thumb.

➕ show 1 reply
Cpoll • yesterday at 5:34 PM

[dead]