Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect segment counting #39

Open
kasyrm opened this issue Apr 26, 2023 · 2 comments
Open

Incorrect segment counting #39

kasyrm opened this issue Apr 26, 2023 · 2 comments

Comments

@kasyrm
Copy link

kasyrm commented Apr 26, 2023

I spotted a similar issue to this one: #18.

When providing a message like this one:
]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]

Segment calculator shows it's 3 segments.

It's 153 scalars counted as 306 characters. That's 2142 bits for characters + 96 bits for 2 headers. That should add up to 2238 bits so still within 2 segments.

But when adding the last character of this string another header is added and the message takes up 2286 bits: 3 segments.

There are other calculators that show this as 2 segments (https://sakari.io/sms-length-calculator/)

But when sending the message on Twillio it is sent as 3 segments. So I have been wondering which is correct and what is causing this behaviour.

@jarangutan
Copy link

jarangutan commented Apr 13, 2024

I don't believe that the segment calculator is incorrect. For GSM-7 encoding, ] is hex 1B3E which is reflected accurately as 0x001B 0x003E. Right square bracket is one of the extra characters in the extension table that use the escape character 0x001B. That escape character makes right square bracket into two characters rather than one, which eats into the message character limit. See here https://www.developershome.com/sms/gsmAlphabet.asp

Paraphrasing a bit:

GSM 7-bit default alphabet consists of 128 characters with each character being represented by 7 bits. 10 extra characters are defined in an extension table and are represented through an escape mechanism using the escape character 0x1B. The 10 extra characters are:

  • Form feed
  • Caret / circumflex
  • Left curly bracket
  • Right curly bracket
  • Backslash
  • Left square bracket
  • Tilde
  • Right square bracket
  • Vertical bar
  • Euro sign

@amanovofficial
Copy link

amanovofficial commented Apr 18, 2024

]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]

Checked out this string using https://messente.com/documentation/tools/sms-length-calculator
it shows that the string splits into 2 segments but your calculator considers it as 3 segments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants