Encoding and long messages
GSM 7-bit, UCS2, long messages with UDH and how segments are counted.
Two encodings
| Encoding | data_coding | Use for | Characters per SMS |
|---|---|---|---|
| GSM 7-bit | 0 | English and most Latin letters | 160 |
| UCS2 | 8 | Any other script, emoji, some accented letters | 70 |
One character outside the GSM 7-bit set makes the whole message UCS2. Typing curly quotes or an emoji by mistake can double the cost.
These GSM characters count as two: ^ { } [ ] ~ \ | € and the form feed.
Long messages
A message longer than one SMS is split into segments. Each segment carries a small header (UDH) so the phone can join them back. The header takes some space, so each segment holds less:
| Encoding | One segment | Each segment of a long message |
|---|---|---|
| GSM 7-bit | 160 characters | 153 characters |
| UCS2 | 70 characters | 67 characters |
Examples:
| Message | Segments |
|---|---|
| 160 GSM characters | 1 |
| 161 GSM characters | 2 (153 + 8) |
| 306 GSM characters | 2 |
| 307 GSM characters | 3 |
| 70 UCS2 characters | 1 |
| 71 UCS2 characters | 2 (67 + 4) |
How to send a long message over SMPP
Option 1, UDH (recommended):
- Split the text into parts of 153 (GSM) or 67 (UCS2) characters.
- Start each part with a 6-byte UDH:
05 00 03 RR TT NN, whereRRis a reference number shared by all parts,TTthe total parts andNNthis part's number, starting at 1. - Set
esm_class = 0x40on every part. - Send each part as its own
submit_sm.
Option 2, message_payload: put the full text in the message_payload TLV and leave short_message empty. We split it for you.
What you pay
You pay one credit per segment. A 3-segment message costs 3 credits. On the HTTP API, the price is per segment too.
To be confirmed
Use UDH where you can. Support for the message_payload TLV, and the most segments allowed in one message, have not yet been checked on the live SMS YANU server.