How do I get emojis and other entities entered and posted to Twitter via the API to appear as they should?


We created a platform where users can enter kind words and have them tweeted anonymously to another user via our account.

However, when a user attempts to enter an emoji or even a simple heart symbol (:heart:), the tweet displays a string of characters instead of the symbol.


I’m relatively sure this has something to do with encoding, and I’ve spent hours experimenting with how to fix it to no avail.

If anyone can shed any light on this, I’d be eternally grateful!



Make sure that the encoding is UTF-8 application/x-www-form-urlencoded… It appears you’re HTML entity encoding the text instead.


I am trying to update some old php code that used to correctly output unicode symbols but now doesn’t.

For example, including the string :open_umbrella: used to tweet the umbrella, but now it tweets the string as written.

I have been going crazy trying to figure out how to encode that character and similar ones in such a way that using the API results in the tweet displaying correctly.

Can someone point me to an example?



Thanks! This worked like a charm!