Skip to content

Allow a wider range of unicode characters in text messages - #1443

Draft
quis wants to merge 6 commits into
mainfrom
allow-unicode-sms
Draft

Allow a wider range of unicode characters in text messages #1443
quis wants to merge 6 commits into
mainfrom
allow-unicode-sms

Conversation

@quis

@quis quis commented Aug 10, 2026

Copy link
Copy Markdown
Member

This is a proof of concept, need to think more about how we’d roll this out to the apps.

@quis
quis force-pushed the allow-unicode-sms branch 4 times, most recently from 9083039 to be8a6f8 Compare August 10, 2026 14:29
@quis
quis force-pushed the count-unicode-characters-in-sms branch 3 times, most recently from acb5ec4 to 65f3ef4 Compare August 10, 2026 15:51
quis added 5 commits August 10, 2026 16:52
This is a proof of concept, need to think more about how we’d roll this
out
We can treat it like any other unicode character now, for SMS.

When sanitising text to ASCII I think it’s still nice to treat this as a
special case, otherwise it will get downgraded to ?
We don’t treat these any differently to other non-GSM characters now.
It’s just as alias for `SanitiseSMS.encode` which adds another lay of
indeirection, and it’s not used by any of the apps.
The zero width joiner character is used to combine multiple emoji into
new, novel emoji.

Therefore stripping it out can cause these newer emjoi to decompose into
their constituent parts, which looks odd.

We don’t want to introduce a breaking change by changing the behaviour
of `formatters.normalise_whitespace` etc, which are used all over the
place. So instead we add an optional flag which the SMS template classes
can pass in.
@quis
quis force-pushed the allow-unicode-sms branch 2 times, most recently from f89a52d to cdbb4ad Compare August 10, 2026 16:24
The order of operations should always be:
- remove whitespace before punctuation
- encode the resulting content

Otherwise things which are downgraded to full stops (for example
`…` to `...`) will have the whitespace removal applied, which might
not be appropriate.

`SMSMessageTemplate` was working this way already, but `SMSPreviewTemplate`
and `SMSBodyPreviewTemplate` were doing it the other way. This commit
ensures they are all consistent.

---

We need to replace lower quotation marks with ASCII ones because at
least one of our providers does this for us. So if we don’t do it too we
could end up with a mismatch between what we send (straight quotes) and
what we charge our users for (low quotes).
@quis
quis force-pushed the allow-unicode-sms branch from cdbb4ad to c798a63 Compare August 10, 2026 16:53
Base automatically changed from count-unicode-characters-in-sms to main August 12, 2026 16:13
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.

1 participant