2

I'm currently building an application which uses Nexmo to send SMS messages to users. But I'm experiencing some problems with the encoding of messages. Probably worth metioning; I'm using the prawnsalad/Nexmo-PHP-lib library to connect with their API.

A simple text messages of 160 characters is divided into 3 separate messages. According to the Nexmo support, this is caused by the encoding of the message. So to provide me with some more information I recevied the follow information about the encoding:

The maximum number of characters per message depends on the encoding: - 160 characters for 7-bit encoding (e.g. Latin-1/9 and GSM8) - 140 characters for 8-bit encoding (Binary) - 70 characters for 16-bit encoding (Unicode)

The maximum number of characters per concatenated message depends on the encoding: - 153 characters for 7-bit encoding (e.g. Latin-1/9 and GSM8) - 134 characters for 8-bit encoding (Binary) - 67 characters for 16-bit encoding (Unicode)

When I use the 7BIT encoding (mb_convert_encoding('message', '7bit')) the entire message goes out as a single text message... BUT characters like "é", "è", "à", "ù" are removed from the message. There must be a way to include this charachters and still send out the message as 1 message and not 3.. right? But how?

I really hope that someone here can help with this issue, even the support of Nexmo took a step back from this encoding issue :p

1

2 Answers 2

2

Unfortunately these characters are not included in the GSM8 encoding, which is explained in great detail here: http://www.clockworksms.com/blog/the-gsm-character-set/

If you're required to use those characters there is no way around 8-bit encoding and thus fewer characters.

The same thing happens if your SMS on your mobile shows current character usage, then the character count changes drastically whenever you are using characters not included in the GSM8 encoding.

0

Nexmo/Vonage supports two main types of encoding for the SMS API : text and unicode.

Unicode is limited to 70 characters, Text is 160. Nexmo PHP lib is by default set to Unicode, you have to set it to text

new SMS($sms_number, $sms_from, $sms_content, 'text') 

You can use this characters in Text without problem : "é", "è", "à", "ù".

More information in Nexmo SMS encoding documentation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.