Encoding and length
How many characters fit in a part, and why one emoji can double the price.
An SMS part carries 140 bytes. Which characters you use decides how many fit: each message is sent in one of two encodings, chosen for the whole message.
| Encoding | One part | Each part of a longer message | Longest message (10 parts) |
|---|---|---|---|
gsm7: GSM-7 | 160 characters | 153 characters | 1,530 characters |
ucs2: Unicode | 70 characters | 67 characters | 670 characters |
Part of every longer message's space goes on the header that joins the parts again on the phone, hence 153 and 67. The response's encoding and segments say which applied and how many parts you were billed for.
GSM-7#
Used when every character is in the GSM alphabet: Latin letters A–Z and a–z, digits, common punctuation, and a few accented letters such as é è ù ì ò Ä Ö Ü ä ö ü ñ à. These count double, as they take an escape character:
^{}\[]~|€
Unicode (UCS-2)#
One character outside GSM-7 switches the whole message to Unicode, at 70 characters a part: Cyrillic, Greek lowercase, Arabic, Chinese, and also curly quotes “ ”, long dashes —, á í ó ú ç and emoji. Emoji and other characters outside the basic plane count as two.
| Text | Encoding | Parts |
|---|---|---|
Your code is 482913 | GSM-7 | 1 (19 of 160) |
Ваш код: 482913 | Unicode | 1 (15 of 70) |
Hello 🙂 | Unicode | 1 (8 of 70: the emoji makes it Unicode, and counts as two) |
Smart encoding#
Texts pasted from documents often carry typographic characters that look like plain ones. Send "smart_encoding": true and these are replaced before the encoding is chosen, so the message stays GSM-7:
| Replaced | With |
|---|---|
‘ ’ ‚ ‛ | ' |
“ ” „ ‟ « » | " |
– — − • | - |
… | ... |
| Non-breaking and thin spaces | A space |
| Zero-width spaces and byte-order marks | Removed |
It doesn't change letters: a text in Cyrillic or with an emoji stays Unicode.
The console's Send page shows a text's parts and encoding as you type it.