devict / votelocal

A web app for receiving local voting information via SMS
15 stars 16 forks source link

Start GSM sanitization #115

Closed sethetter closed 4 years ago

sethetter commented 4 years ago

Starts with replacing emdash, but I'm sure there are some other common offenders we could catch here.

Closes #103

sethetter commented 4 years ago

I can't find anything online that provides guidance of common GSM offenders, so maybe just reviewing the logs on Twilio for USC-2 encoded messages and adding to this list of over time is our best bet?

imacrayon commented 4 years ago

My understanding is that anything outside of the characters listed on this page will cause Twillio to send only 70 chars per message. The library I linked to in the review note will try to shift unsupported charters to a character that is similar visually like an em dash to a dash. Anything it can’t shift will show as a “?”.

imacrayon commented 4 years ago

Wait! it looks like Twilio library might already be able to do this?

Maybe try adding 'smartEncoded' => true, after this line

sethetter commented 4 years ago

@imacrayon that worked like a charm! Thank you!

sethetter commented 4 years ago

I confirmed in the twilio console after sending myself a message previously UCS-2 encoded that it's replacing the emdash char and coming through as GSM encoded 🎉