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
Split the message yourself and send one submit_sm per part, with UDH or SAR. Split into parts of 153 (GSM) or 67 (UCS2) characters. The phone joins them back.
Option 1, UDH (recommended):
- 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, SAR: leave the UDH out and put these TLVs on every part:
| TLV | Tag | Value |
|---|---|---|
sar_msg_ref_num | 0x020C | A reference number shared by all parts. |
sar_total_segments | 0x020E | The total parts. |
sar_segment_seqnum | 0x020F | This part's number, starting at 1. |
message_payload
Not for long messages
The message_payload TLV works only for text that fits one SMS: up to 160 bytes, or 140 for UCS2 or binary. It is then moved to short_message for you. Anything longer is refused with 0x00000001 ESME_RINVMSGLEN and is not charged. JT Noble SMS does not 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.