Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Emoji icons interrupting REST call

Emoji icons interrupting REST call


In testing out our API, one of our testers found out that when they insert an emoji icon on their iOS device, it will successfully save to our MongoDB, however when retrieving it they do not get a response. I confirmed this, and our server (Node.js) will get the request, and start to send the data, but (I think) somewhere along the line, the emoji characters "terminiate" the request, or cause it never to finish in the eyes of the iOS client.

Has anyone experienced this? If so what is the best way you've gotten around with dealing with Emoji Icons. I know one way is to unescape() every string that goes out from Node.js, but it seems like a not-so-clean approach, and also I'd need to decode the text on the client-side.

Problem courtesy of: ewindsor


MongoDB supports utf8, unfortunately the emoji characters are utf8mb4 which many applications and languages don't yet support (including MongoDB). Unescape seems like the best thing to do currently.

Alternatively you could store it as binary, but then you would need to query it differently and wouldn't be able to query with regular expressions (but would retain the native characters).

Solution courtesy of: Steve Francia


View additional discussion.

This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

Emoji icons interrupting REST call


Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription