Development

Encode SMS messages using Infobip textual or binary API methods

What will happen if you try sending an SMS message written in Cyrillic, Greek, Arabic, Hebrew or other alphabets with specific characters without having a Unicode encoding?

July 24 2015

Even though a large portion of professional SMS messaging uses the basic GSM alphabet (which supports all Latin characters, digits and a few special characters), some apps, companies and brands prefer to use their own alphabets when communicating with their audiences over SMS.

What happens if you send an SMS message in Cyrillic, Greek, Arabic, Hebrew or other alphabets with specific characters, without having the Unicode encoding? Recipients will get a message they won’t be able to read because their phone couldn’t recognise that kind of data coding.

To avoid generating such unreadable messages, we are offering you two ways of sending Unicode (UTF-8) messages - with textual or binary ”Send SMS” methods.

If you choose to send Unicode messages over textual Send SMS methods, unconverted Unicode text should be inserted in the "text" parameter:

POST /sms/1/text/single HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/json

{  
   "from":"InfoSMS",
   "to":"41793026727",
   "text":"Hello world, Καλημέρα κόσμε, コンニチハ"
}

The Unicode message will be automatically sent to the mobile phone.

On the other hand, if you want to send Unicode with custom data coding over binary Send SMS methods, the message text should be converted into hexadecimal representation. The hexadecimal content should be inserted in the “hex” parameter and also, you should set “dataCoding” parameter to 8 (UTF-8):

POST /1/sms/binary/single HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/json

{  
   "from":"InfoSMS",
   "to":"41793026727",
   "binary":{  
      "hex":"48 65 6c 6c 6f 20 77 6f 72 6c 64 2c 20 ce 9a ce b1 ce bb ce b7 ce bc e1 bd b3 cf 81 ce b1 20 ce ba e1 bd b9 cf 83 ce bc ce b5 2c 20 e3 82 b3 e3 83 b3 e3 83 8b e3 83 81 e3 83 8f",
      "dataCoding":8,
      "esmClass":0
   }
}

Important:

When sending messages with one or more non-GSM characters (for example Unicode), the text of the message is limited to 70 characters. Here you can find what characters are included in GSM set.

Make sure your messages are clear and readable in any language or alphabet - use Infobip SMS API! Try out our language-specific features - SMS Transliteration and SMS language - to overcome character limitation and optimise your costs.

We’re running a global messaging platform which sends out more than 1,000,000 SMS on a daily basis, reaching more than ⅓ of the world’s population. With offices on six continents and more than 200 direct connections to mobile network operators worldwide, we can’t afford to forget about language specifics!