DEV Community

Cover image for Removing people using UTF-8 πŸ‘©β€πŸ‘©β€πŸ‘¦β€πŸ‘¦
Jan Cizmar
Jan Cizmar

Posted on

Removing people using UTF-8 πŸ‘©β€πŸ‘©β€πŸ‘¦β€πŸ‘¦

While I was writing my new article I found out about really cool thing I am going to share with you.

Check out this emoji containing 4 people πŸ‘©β€πŸ‘©β€πŸ‘¦β€πŸ‘¦.

While I was trying to delete πŸ‘©β€πŸ‘©β€πŸ‘¦β€πŸ‘¦ in VSCode using backspace it
didn't disappear, but it just changed to this πŸ‘©β€πŸ‘©β€πŸ‘¦. After hitting another backspace it changed to πŸ‘©β€πŸ‘© then to πŸ‘© and then it finally disappeared. So it goes

πŸ‘©β€πŸ‘©β€πŸ‘¦β€πŸ‘¦ ⌫ πŸ‘©β€πŸ‘©β€πŸ‘¦ ⌫ πŸ‘©β€πŸ‘© ⌫ πŸ‘© ⌫
Enter fullscreen mode Exit fullscreen mode

Why this happens?

When we look on the decoded symbols, we can see that the symbols are equal to this in hex:

πŸ‘©β€πŸ‘©β€πŸ‘¦β€πŸ‘¦:  0x1f469 0x200d 0x1f469 0x200d 0x1f466 0x200d 0x1f466
πŸ‘©β€πŸ‘©β€πŸ‘¦β€πŸ‘¦:  0x1f469 0x200d 0x1f469 0x200d 0x1f466
πŸ‘©β€πŸ‘©:    0x1f469 0x200d 0x1f469
πŸ‘©:   0x1f469
Enter fullscreen mode Exit fullscreen mode

While 0x200d character is a "ZERO WIDTH JOINER" which tells the renderer, that the preceding and following characters should join each other. πŸŽ‰

So it is like πŸ‘© + πŸ‘© + πŸ‘¦ + πŸ‘¦.

Cool isn't it?

PS:

Removing of single woman works as well, so this πŸ‘©β€πŸ‘¦β€πŸ‘¦ can transformed to the hex code like this: 0x1f469 0x200d 0x1f466 0x200d 0x1f466

Top comments (0)