What is GSM-7 character encoding?
The original assignment of 128 alphanumeric characters accepted and displayed in text messages to numerical values for transmission across mobile networks. This assignment of characters to numeric values is character encoding.
Global System for Mobile Communications (GSM) codified these assignments in GSM 03.38 (PDF). GSM-7 encodes each character as 7 bits. As Short Message Service (SMS) messages transmit 140 bytes at a time, SMS messages encoded with GSM-7 can include 160 characters.
(140 bytes × 8 bits) / 7 bits = 160 characters
To support local languages, devices use shift tables or change the text encoding to Universal Coded Character Set–2 byte (UCS-2) that uses 16 bits per character.
Some characters, such as { and ], need an escape character. These escape characters count as two characters in a GSM-7-encoded message.