Monday, May 1, 2017

Emojis in the Website Titles

It's not very common, but website titles might contain emojis. Until now if you wanted to add such a webpage to Ninja, it failed, you couldn't add the link. Now it has been fixed.


Technical background

The Bookmark Ninja MySQL database is configured for UTF8 encoding, that supports a maximum of 3 bytes per character. Emojis are stored in 4 bytes. This was the problem.

An obvious fix could have been to change the encoding in the database from UTF8 to UTF8MB4, that supports a maximum of 4 bytes per character. But the performance of 4-byte UTF8MB4 is slower than for 3-byte UTF8. I didn't want to sacrifice the performance just because there are a very few websites out there with titles including emojis.
Instead I made a fix, that replaces the emojis in the title with a � character.

No comments:

Post a Comment