Question

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.

Was it helpful?

Solution

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).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top