SMS Fundamentals & Encoding
Telecommunication network architecture, GSM-7 vs. UCS-2 character sets, segmentation math, and automatic phone normalization.
Short Message Service (SMS) is a store-and-forward message. This page covers how a message moves from your app to a handset, how encoding changes the segment count, and how phone numbers are cleaned on the way in.
1. Path of a message
SMS Pro accepts the API call. The carrier delivers the SMS. The handset result comes back later as a delivery status.
2. Character Encodings: GSM-7 vs. UCS-2
Every character in an SMS payload is encoded as either GSM 7-bit default alphabet or UCS-2 (16-bit Unicode). This distinction directly controls message segment capacity and billing units.
GSM 7-bit Encoding (Standard)
The GSM 03.38 standard defines 128 basic characters (A-Z, a-z, 0-9, standard punctuation, and select Greek symbols). Because each character requires only 7 bits of data, a standard 140-byte telecommunication signaling packet holds up to 160 characters.
- Single Segment Maximum: 160 characters.
- Concatenated Segment Maximum: 153 characters (7 bytes are consumed by the User Data Header for reassembly).
UCS-2 Encoding (Unicode)
If an SMS payload contains even a single character outside the GSM-7 table (such as an emoji 👋, accented character, Arabic, Chinese, or specialized punctuation like curly quotes “), the entire message must be encoded using UCS-2.
Each character in UCS-2 requires 16 bits (2 bytes). This drastically reduces the capacity of a 140-byte signaling packet:
- Single Segment Maximum: 70 characters.
- Concatenated Segment Maximum: 67 characters (6 bytes are consumed by the User Data Header).
| Metric | GSM 7-bit Encoding | UCS-2 Unicode Encoding |
|---|---|---|
| Bits Per Character | 7 bits | 16 bits (2 bytes) |
| Single Message Capacity | 160 characters | 70 characters |
| Multi-Part Segment Capacity | 153 characters / segment | 67 characters / segment |
| Trigger Characters | Latin letters, numbers, standard symbols | Emojis (🚀), smart quotes (“”), non-Latin alphabets |
| Billing Impact | 1 unit per 160 chars | 1 unit per 70 chars (~2.3x more units) |
The Single-Emoji Multiplier
A 150-character plain text message is billed as 1 SMS unit. Adding a single emoji converts the message to UCS-2, splitting the 151 characters into 3 concatenated segments (67 + 67 + 17 characters), tripling your unit cost.
3. SMS Segmentation & Concatenation
When a message exceeds the single-segment threshold, the SMS Pro gateway divides the text into concatenated segments. Each segment includes a 6-byte User Data Header (UDH):
- UDH Contents: Information Element Identifier (IEI), CSMS reference number, total segment count (N), and current segment index (n).
- Handset Reassembly: The receiving mobile device buffers the incoming segments, orders them using the UDH sequence numbers, and displays them as a single seamless text to the user.
Segmentation Calculation Example (GSM-7)
segments = length <= 160 ? 1 : Math.ceil(length / 153)- Length = 160 characters $\to$ 1 segment (160 used).
- Length = 161 characters $\to$ 2 segments (153 + 8 used).
- Length = 306 characters $\to$ 2 segments (153 + 153 used).
- Length = 307 characters $\to$ 3 segments (153 + 153 + 1 used).
4. Phone Number Normalization & E.164
SMS Pro cleans numbers on ingest:
Supported Input Formats
- Local with leading zero (
0241234567): 10 digits; leading0is replaced with national dial code233. - National without zero (
241234567): 9 digits; prepends national dial code233. - International without plus (
233241234567): 12 digits; validated and preserved. - E.164 with plus (
+233241234567): The leading+is removed. - Punctuation & Spaces (
+233 (24) 123-4567): All non-digit characters are automatically stripped.
Automatic Deduplication
If an API request or campaign file lists both 0241234567 and +233241234567, the engine detects identical normalized MSISDNs and deduplicates the recipient to prevent duplicate message delivery and billing.
5. Architectural Best Practices
- Sanitize Dynamic Template Inputs: If inserting user names or external database strings into SMS templates, strip invisible non-GSM characters (e.g. zero-width spaces or smart quotes) to prevent unintended UCS-2 conversion.
- Pre-Calculate Segment Counts: Check the
segmentCountin the202 Acceptedresponse to monitor billing consumption in real time. - Use Shortlinks for Long URLs: URLs consume massive character counts. Use SMS Pro Branded Shortlinks to condense links to under 20 characters while gaining click analytics.