Text Message Character Encoding and Message Length
The SMS Message request parameters should be encoded in the UTF-8 character set. For all GET request API calls, all non-ASCII characters in the URL parameters should be encoded using URL encoding. We support following character sets for the SMS messages.
- Supported character sets
- GSM 03.38 encoding
- Unicode
- Message length
- GSM 03.38 encoding
- Unicode
Supported character sets
GSM 03.38 encoding
GSM 0.3.38 is a standard character set for the SMS delivery used universally. GSM 03.38 characters set allows you to includes the Latin alphabet and the most common accented forms, certain special characters, and the Greek alphabet.
@ Δ SP 0 ¡ P ¿ p £ _ ! 1 A Q a q $ Φ " 2 B R b r ¥ Γ # 3 C S c s è Λ ¤ 4 D T d t é Ω % 5 E U e u ù Π & 6 F V f v ì Ψ ' 7 G W g w ò Σ ( 8 H X h x Ç Θ ) 9 I Y i y LF Ξ * : J Z j z Ø ESC + ; K Ä k ä ø Æ , < L Ö l ö
The Extended GSM character set
Some additional characters can be sent using the <ESC > (0x1B) code in the above table plus an additional character; these extended characters are known as the Extended GSM character set and require 2 standard GSM characters per extended GSM character due to requiring the escape character prefix.
Dec | Hex | Char |
27, 101 | 1B, 65 | € |
27, 10 | 1B, 0A | <FF> |
27, 60 | 1B, 3C | [ |
27, 47 | 1B, 2F | \ |
27, 62 | 1B, 3E | ] |
27, 20 | 1B, 14 | ^ |
27, 40 | 1B, 28 | { |
27, 64 | 1B, 40 | | |
27, 41 | 1B, 29 | } |
27, 61 | 1B, 3D | ~ |
Unicode:
Anytime if there are non-GSM 03.38 characters present in the SMS message, the whole message will be encoded as a Unicode character set. The Unicode character set allows developers to send SMS message international languages such as Chinese, Arabic, Japanese,
etc.
Message Length
GSM 03.38 encoding
Number of SMS Messages | Total number of characters in the concatenated message |
---|---|
1 | 160 |
2 | 306 |
3 | 459 |
4 | 612 |
5 | 965 |
6 | 718 |
Unicode
Unicode encoding restricts messages to a maximum of 70 characters per Text Message, since unicode characters takes twice the space. Unicode messages can also use concatenation to send longer messages. The table below gives the number of message parts required to deliver a longer unicode character messages. Each part is counted as one text message for the billing purpose.
Number of SMSs | Total number of characters in the linked message |
---|---|
1 | 70 |
2 | 134 |
3 | 201 |
4 | 268 |
5 | 335 |
6 | 402 |
Suggestion:
Specific common characters that you should avoid using to ensure your message is sent using the more efficient GSM character set are:
` should be ' ‘ this apostrophe is formatted by MS Office. Note the difference between ‘ and ' “ should be " ” should be " ~ should be - ¬ should be - | should be avoided altogether, otherwise, use an uppercase I
You can use the following tool to replace some of the unnecessary Unicode characters with equivalent GSM characters: Unicode Detect Tool
Encode your API
What is URL encoding?
URL encoding converts special characters into friendly HTTP GET request that can be sent through the internet. You should use URL encode for all GET parameters.
Why URL encoding?
The data you’re sending to a web service using HTTP Get request must be encoded, any character that is not an alphabetic character, a number, or a special character that is being used outside its normal context is going to need to be encoded in your request.
URLs often contain characters which conflict with HTTP Get request reserved characters such as (&, /, ?) must be escaped.
How do you encode a URL?
To encode a URL, you simply replace the special characters with their encoding string. This will nearly always begin with a % character. All modern programming languages offer libraries to encode URLs, such in C# use HttpUtility.UrlEncode() and PHP: string urlencode (string $str)
Example:
GET
https://msgapi.wire2air.com/smsapi/submitsm.aspx?vasid=yourvasid&userid=YourAuthKey&password=yourpassword&from=27126&to=9999999999&text=A sample text & Message
GET
https://msgapi.wire2air.com/smsapi/submitsm.aspx?vasid=yourvasid&userid=YourAuthKey&password=yourpassword&from=27126&to=9999999999&text=A%20sample%20text%20%26%20Message
Text=A sample text & Message encoded to : A%20sample%20text%20%26%20Message
Note: Some of the characters will not be displayed correctly due to handset limitations