My friend Dave sent me a bug report tonight relating to his attempt to post a comment here that contained an emoji:
Hmm. I got this while submitting a comment. On iOS obviously. I had loaded the page without content blockers, which I seem to need to do for your comments to work.
The comment I was submitting: βI think I know this woman of whom you speak. πβ
He attached a screen shot from his iPhone, showing the error dialog he received:
Now, first off, this made me realize that I’d left display of detailed error messages turned on for the Drupal that runs this site; to fix thatβnot the source of the issue, but a good idea on a production siteβI turned that off, under Development > Logging and errors.
Next, to the problem at hand: I suspected that it was Dave’s need to post a comment containing a winking face emoji (π) that was the source of the error, and suddenly I realized the implication of the warning in my Drupal status report, heretofore ignored, about the lack of β4 byte UTF-8β support:
It turns out that characters like emoji are represented by 4 bytes. In the case of the winking emoji, it turns out, these 4 bytes are \xF0\x9F\x98\x89, and, indeed, if you look at the error Drupal was throwing up about Dave’s comment, you can see that being flagged as an βincorrect string value.β
The solution turned out to be simple: following the helpful instructions here, I converted the MySQL database for this Drupal to support 4 byte UTF-8. There were several steps to this: first I needed to add support in MySQL by editing my my.cnf file, then I had to convert the database and its tables, and finally I had to edit my settings.php to reflect the change. Once I did this, I was able to post emoji-laced comments at will.
Go wild, Dave.
Comments
Is this thing on? ,ποΈπ©βπ€π½
Is this thing on? ποΈπ©βπ€π½
ππΌ ππ»ππ»π
ππΌ ππ»ππ»π
ππ½
ππ½
Excellent π»
Excellent π»
Once I made the update
Once I made the update described here, I had the follow-on issue of my Tiny Tiny RSS installation not supporting the selfsame emoji that my readers are now posting. Fortunately, Simon Krenger had the same issue, and documented his fix.π¨π»π
Add new comment