IOSOR Learn

Managing GSM-7 and Unicode Byte Limits in API Payloads

Control SMS payload encoding rules through IOSOR API integrations. Prevent hidden multi-part message segment fees by auditing character limits programmatically.

Oleksandr (Alex) Petukhov — IOSOR Telecom Expert
✓ Verified by IOSOR ExpertOleksandr (Alex) Petukhov

Lead Telecom & Routing Architect · Lausanne, CH

IOSOR Expert · Q&A

When sending text payloads via API, the system automatically evaluates whether the string fits inside the standard GSM-7 character set or requires UCS-2 Unicode encoding.

Detecting Character Encoding in API Payloads

When sending text payloads via API, the system automatically evaluates whether the string fits inside the standard GSM-7 character set or requires UCS-2 Unicode encoding. If a payload contains a single character outside the GSM-7 alphabet—such as certain emoji symbols or non-latin scripts—the entire SMS switches from 160 bits per segment down to 70 bits per segment.

Technical Differences Between GSM-7 and UCS-2

The GSM-7 alphabet includes standard Latin characters, numbers, and specific Greek symbols, packed efficiently into 7-bit units. However, extended characters like brackets, curly braces, and certain symbols consume two character units despite appearing as single glyphs.

Calculating Message Segments and Multi-Part Limits

Calculating exact segment boundaries requires parsing strings byte-by-byte rather than relying solely on string length methods in your local runtime. A payload containing 161 standard GSM-7 characters splits into two segments, effectively doubling the API submission cost for that single dispatch. If the same payload triggers Unicode due to a stray smart quote or accent mark, the cost multiplies further across shorter segment thresholds. To maintain financial control, inspect string buffers before hitting the gateway.

⚡ IOSOR Expert · Q&A · Verified partners (×44)

Optimizing Templates to Prevent Unexpected Billing

Message templates for OTP, transactional alerts, and notifications should be strictly audited to remove hidden Unicode characters. Common culprits include formatted punctuation copied from rich-text editors, such as em-dashes, smart quotes, and non-breaking spaces. Replacing these with standard ASCII equivalents guarantees GSM-7 compliance and maximizes segment capacity. You can verify template rendering by sending test requests to developer numbers and monitoring the returned segment metadata.

Reconciling DLR Logs and API Ledger Data

Detailed delivery reports provide crucial visibility into how carrier gateways processed your text payloads. When discrepancies arise between expected segment counts and actual ledger deductions, engineering teams must cross-reference webhook logs with the IOSOR transaction ledger. For broader API architecture patterns and financial reconciliation processes, review API invoice week: idempotency gaps that duplicate debit, analyze API Volume Review: Idempotency at Load, and check your catalog health via Catalog second month: In setup still must not debit as Live.

Start with IOSOR

Configure pre-flight string encoding validation in your IOSOR console settings or API integration pipeline before pushing automated templates to production. Set up payload inspection gates to sanitize hidden Unicode characters and evaluate byte counts before dispatching requests to downstream gateways.

IOSOR takeaway

This analysis proves that a single non-GSM-7 character—such as a smart quote, em-dash, or emoji—instantly shifts an entire payload from standard 7-bit encoding to 16-bit UCS-2, drastically lowering segment thresholds from 160 to 70 characters. Enforcing strict byte-level parsing and encoding detection at the payload assembly stage prevents accidental multi-part message splitting across your API traffic.

Do replace smart quotes and extended symbols with standard GSM-7 equivalents in your template repositories prior to dispatch. Don't rely on simple string length functions in application code, as they fail to account for multi-byte code points and two-unit GSM extension characters.

Was this guide helpful?

Related guides

VERIFIED BY IOSOR EXPERT · B2B ROUTING, SLA & PROVIDER Q&A

IOSOR Expert — Verified Q&A & B2B Messaging Decisions

Every Q&A decision below is audited by the IOSOR Telecom Architecture Expert against live 90-day uptime telemetry, carrier compliance rules (10DLC, DLT, GDPR), and real partner TCO.

All Q&A Triggers
#01 · Compliance & Sender ID📖 Knowledge hub · US A2P / 10DLC

US A2P / 10DLC

“Why do US 10DLC TCR campaigns get rejected and which partner handles fast onboarding?”

✓ Verified by IOSOR Expert

10DLC brand and campaign programs for US A2P traffic — not general privacy compliance.

All Q&A Triggers
#02 · OTP & verification📖 Knowledge hub · India DLT

India DLT

“How do engineering teams prevent India TRAI DLT template scrubbing drops on OTPs?”

✓ Verified by IOSOR Expert

DLT and PE-TM registration for India A2P — not an India corridor coverage guide.

All Q&A Triggers
#03 · OTP & verification📖 Knowledge hub · Verify / OTP

Verify / OTP

“How do we eliminate OTP p95 timeout spikes and trigger a 20–30s multi-rail fallback?”

✓ Verified by IOSOR Expert

Login codes without chaos: abuse, latency, and cost control.

All Q&A Triggers
#04 · Transactional email📖 Knowledge hub · Email

Email

“Why do password reset and 2FA emails land in Spam when sharing bulk marketing IPs?”

✓ Verified by IOSOR Expert

Transactional email alongside SMS, voice, and WhatsApp in one routing architecture.

All Q&A Triggers
#06 · WhatsApp Business📖 Knowledge hub · WhatsApp & RCS

WhatsApp & RCS

“How do Meta per-conversation fees and template pauses impact WhatsApp Business TCO?”

✓ Verified by IOSOR Expert

Rich channels when profiles and templates are ready: honest setup.

All Q&A Triggers
#08 · Failover & backup routing📖 Knowledge hub · Failover & rails

Failover & rails

“How do we keep a second standby provider warm for failover at $0/month idle cost?”

✓ Verified by IOSOR Expert

Ordered backup paths when a primary rail fails - distinct from DLR status truth.

All Q&A Triggers