prawnsalad / Nexmo-PHP-lib

Nexmo SMS gateway example library
MIT License
121 stars 98 forks source link

Message length problem #21

Open mikevrind opened 9 years ago

mikevrind commented 9 years ago

Hello,

I'm currently using this lib to connect to the Nexmo API. But I'm having some issues with the length of a text message.

I have a message that contains 160 chars, but still get split up into 3 separate SMS messages. According to the Nexmo website, 160 characters should fit into 1 message. But why doesn't Nexmo send just 1 message?

jbtibor commented 8 years ago

An SMS can have 140 bytes (140 * 8 bits) not 160 characters. You can have 160 characters when using a 7 bit character set, however most if not all smartphones default to 16 bit unicode so the character limit will be 70 and 160 chars will be sent as 3 messages. This isn't down to Nexmo, most if not all phones will split long messages into parts before sending. https://en.wikipedia.org/wiki/Short_Message_Service#Message_size

You'll have to handle concat- flags sent by Nexmo, not exposed in NexmoMessage. https://docs.nexmo.com/index.php/sms-api/handle-inbound-message