GSM encoding for SMS with special characters (Twilio)

拜拜、爱过 提交于 2020-07-18 08:05:13

问题


I hope and you can help me with this query that I have.

I need to send messages with special characters avoiding to segment the message too much, that is, if the maximum number of characters for a GSM message is 160 and I write a message lower than the limit allowed for GSM with the simple fact of having at least one special character this message is change to UCS2.

I do not know if there is a way to avoid this, and that the message is only encoded with GSM without importing special characters to prevent the message from costing more.

Thank you in advance and greetings.

Example (Text):

Encoded: GSM

Message: Hola Señor Cliente le informamos que ya está disponible su crédito, acuda a las oficinas de Compañia o marque al 00110011001.

Length: 125

Segments: 1

Encoded: UCS2

Message: Hola Señor Cliente le informamos que ya está disponible su crédito, acuda a las oficinas de Compañia o marque al 00110011001.

Length: 125

Segments: 2

Example (Image):

GSM

UCS2


回答1:


Twilio developer evangelist here.

You cannot send special characters as a GSM encoded message because those characters do not exist within the GSM character set. This is why Twilio encodes those messages as UCS2 (well, really as UTF16 big endian). However when messages are encoded in UCS2, you can only fit 70 characters.

The only way to ensure that your messages are not encoded as UCS2 is to avoid any characters outside of the GSM character set.

You can read more about how Twilio handles special characters in the API in the first part of this blog post on adventures in unicode SMS.

Let me know if that helps at all.



来源:https://stackoverflow.com/questions/48243887/gsm-encoding-for-sms-with-special-characters-twilio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!