MAHMOUD ABDELNABY
Automation · STATIC INTERACTIVE TOOL · 2

SMS Character Concatenation & Cost Optimization Calculator

Stop getting billed triple for marketing SMS. Detect non-GSM Unicode characters and calculate exact SMS segments instantly.

Problem it addresses

Build an open-source SMS character and encoding cost calculator: 1) Single-file responsive HTML/JS tool (sms_calculator.html) with real-time character counter, GSM-7 vs UCS-2 encoding detection, segment count split (160/153 vs 70/67), and highlighting of offending non-GSM characters, 2) Python CLI script (sms_linter.py) for automated batch testing, 3) Cost estimation worksheet.

Who it is for

BOTH operating in high-growth e-commerce, digital publishing, and direct-response marketing across Saudi Arabia, UAE, and Egypt.

What is inside

Key files listed in the README repository architecture:

  • docs/gsm7-vs-ucs2-explanation.md
  • examples/cost_overage_scenarios.json
  • index.html
  • LICENSE
  • README.md
  • src/sms_calculator.py
  • src/sms_linter.py
  • tests/test_calculator.py
  • tests/test_linter.py
  • tools/sms_calculator.html

How to evaluate and use it

  1. Read the README first and confirm that the documented problem matches your use case.
  2. Inspect the listed files to find the data, tools, templates, and tests relevant to your task.
  3. Follow the repository’s Quick Start and check prerequisites before running commands.
  4. Compare outputs with documented examples and review limitations before using them in a decision or client workflow.

Quick Start from the README: python -m unittest discover -s tests · python src/sms_calculator.py --text "عزيزي العميل، تم تجهيز طلبك رقم 123 بنجاح وسيصلك غداً." --rate 0.15 --currency SAR · python src/sms_linter.py --help

Scope and limitations

  • 3GPP GSM 03.38 Concatenation: Single GSM-7 messages allow up to 160 characters. Concatenated multi-part messages require a 7-byte UDH header, reducing payload capacity to 153 characters per segment.
  • UCS-2 Arabic Multi-Part Limits: Single Arabic messages allow up to 70 characters. Concatenated messages reduce payload capacity to 67 characters per segment.
  • Unicode Supplementary Plane & Surrogate Pairs: Characters outside the Basic Multilingual Plane (> U+FFFF, such as emojis 🚀, 🎉) require 2 UTF-16 code units (surrogate pair) in UCS-2 transmission, consuming 2 units towards the 70 / 67 segment limit.
  • Escape Character Double-Weighting: GSM 03.38 extension characters (| ^ € { } [ ] ~ \) require an escape octet (0x1B), consuming 2 characters from the segment limit.
  • Dynamic Pricing Reliance: Carrier SMS costs vary across Saudi Arabia, UAE, and Egypt; calculation relies strictly on the user-provided per-segment unit rate.

This page summarizes the available documentation; it does not establish performance or business results. Verify data and prerequisites before use.

Related repositories