0

My application retrieves SMSs sent to a Twilio number. When looking at the twilio backend message log, the emojis are displaying correctly.

However, when the webhook is triggered or if the API is called to retrieve message data, I am not receiving a proper UTF-8 representation of the emoji.

For example, The message, Thanks a lot is returned as Thanks a lot 😊.

I did read a couple of other posts which stated that I need to make sure everything is in UTF-8. I confirmed that when using the Twilio SDK, the curl response header shows application/json; charset=utf-8 which is the expected behavior.

To cross-check, I used mb_detect_encoding to determine the encoding of the message body and this returned utf-8 too. I understand that Twilio internally determines if it needs to use GSM-7 or UCS-2 encoding. However, when data is requested from Twilio via curl/sdk, it will encode in UTF-8 for easier translation.

Can someone assist as to why the smiley is being returned as something else instead of the expected utf-8 char?

0 Answers0