GSM-7

ページを評価:

GSM-7はもっとも多くの言語で一般的に使用される文字と記号を7ビットの値として納めた、GSMネットワークで使用するための文字エンコーディングの標準です。 SMSメッセージは一度に140文字、8ビット長を送信するため、GSM-7でエンコードされた文字列は160文字まで送信できます。

GSM-7 Encoding Quirks

GSM-7 is the standard alphabet for SMS messages, written up in the standard GSM 03.38. It is always supported on GSM networks. In languages with more than 128 commonly used symbols, GSM-7 is mandated. However, local language support is implemented with shift tables or by changing text encoding to (16-bit) UCS-2 encoding.

The basic character set for GSM-7 can be found here.

For some characters, such as '{' and ']', an escape code is required - so even in a GSM-7 encoded message these characters will be encoded using two characters.

SMS messages contain 140 8-bit octets, so up to 160 GSM-7 characters may be transmitted: (140*8)/7 = 160.

How Twilio Encodes Your Messages

When sending SMS messages with Twilio, we'll automatically send messages in the most compact encoding possible. If you include any non GSM-7 characters in your message body, we will automatically fall back to UCS-2 encoding (which will limit message bodies to 70 characters each).

Additionally, for long messages--greater than 160 GSM-7 characters or 70 UCS-2 characters--Twilio will split the message into multiple segments. Twilio also prepends a User Data Header of six (6) Bytes to instruct the receiving device on how to re-assemble messages. For multi-segment messages, this leaves 153 GSM-7 characters or 67 UCS-2 characters per segment.

Note that this may cause more message segments to be sent than you expect - a body with 152 GSM-7-compatible characters and a single unicode character will be split into three (3) messages because the unicode character changes the encoding into less-compact UCS-2. This will incur charges for three outgoing messages against your account.

How Do I Check if My Message Can Be Encoded in GSM-7?

This page contains an interactive tool which can check if encoding your message in GSM-7 is possible, or if UCS-2 is needed.

How Can I Avoid My Messages Being Split When I Expect Them to be in GSM-7?

Unfortunately, GSM-7 is not a supported character encoding in many text editors. Even setting encoding to ASCII (or US_ASCII, or UTF-8) will not guarantee that text you write will be limited to GSM-7. You can use the above linked tool to quickly check the number of segments - that is, total messages - some text will be divided into.

If you are writing in an editor with Unicode support you'll need to be particularly careful. Text editors designed for writing might automatically add angled smart quotes, non-standard spaces, or punctuation which looks similar to GSM-7 but is a different Unicode character. We've discussed a few of these issues on our blog.

Ready to Try Twilio Programmable SMS and SMS - With GSM-7 and UCS-2 Support?

Sign up for a free Twilio trial account today - you'll have enough credit to explore the two major encodings we use, and a lot more.

More Information on GSM-7 Encoding and Twilio

ページを評価:

フィードバックくださりありがとうございます!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Sending your feedback...
🎉 Thank you for your feedback!
Something went wrong. Please try again.

Thanks for your feedback!

Refer us and get $10 in 3 simple steps!

ステップ1

Get link

Get a free personal referral link here

ステップ2:

Give $10

Your user signs up and upgrade using link

ステップ3

Get $10

1,250 free SMSes
OR 1,000 free voice mins
OR 12,000 chats
OR more