Skip to content

Don’t double-count extended GSM characters if text message is not GSM encoded #1371

Merged
quis merged 3 commits into
mainfrom
fix-fragment-count-extended-gsm-in-unicode
Jun 15, 2026
Merged

Don’t double-count extended GSM characters if text message is not GSM encoded #1371
quis merged 3 commits into
mainfrom
fix-fragment-count-extended-gsm-in-unicode

Conversation

@quis

@quis quis commented Jun 12, 2026

Copy link
Copy Markdown
Member

Characters like { only count as 2 characters if the message is GSM-encoded.

If characters like Ŵ have caused the message to be unicode-encoded then { counts as 1 character like any other.

This bug existed before #1362 but wasn’t spotted. It’s quite unlikely to make a real-life difference to billing given how infrequently these characters are used in messages.

quis added 3 commits June 12, 2026 15:54
Characters like `{` only count as two characters if the message is
GSM-encoded.

If characters like Ŵ have caused the message to not be GSM-encoded then
`{` counts as 1 character like any other.

This bug existed before https://github.com/alphagov/notifications-utils/pull/1362/files
but wasn’t spotted. It’s quite unlikely to make a real-life difference
to billing given how infrequently these characters are used in messages.
Only 2 is the special case because that’s where the previous fragment
varies in length. The maths in the general case works for 1-fragment
messages
@quis quis changed the title Don’t double-count extended GSM character if text message is not GSM encoded Don’t double-count extended GSM characters if text message is not GSM encoded Jun 12, 2026
@quis quis merged commit 5879992 into main Jun 15, 2026
6 checks passed
@quis quis deleted the fix-fragment-count-extended-gsm-in-unicode branch June 15, 2026 09:34
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

Successfully merging this pull request may close these issues.

2 participants