mileswwatkins / Mouse

A chatbot to provide information to backcountry hikers via satellite SMS
4 stars 1 forks source link

Paginate messages that are longer than a single SMS #5

Open mileswwatkins opened 2 years ago

mileswwatkins commented 2 years ago

Some progress and inline documentation already exists in https://github.com/mileswwatkins/Mouse/blob/main/functions/utils.private.js

If a message is longer than the length of an SMS, modern smartphones just handle it like a single MMS. But Garmin InReach will break it up on its servers and send the message as multiple SMSs. Unfortunately, Garmin will break these up at the character level, and they may not be received in the correct order, eg:

oshi Tajiri in 1996, and is centered on fictional creatures called "Pokémon". In Pokémon, humans, known as Pokémon Trainers, catch and train Pokémon to battle o

ther Pokémon for sport. All media works within the franchise are set in the Pokémon universe. The English slogan for the franchise is "Gotta Catch ‘Em All!". Th

Pokémon is a Japanese media franchise managed by The Pokémon Company, a company founded by Nintendo, Game Freak, and Creatures. The franchise was created by Sat

ere are currently 901 Pokémon species.

So, paginating the message (at the word-break level) into several separate SMSs and labeling their order before sending to Garmin is highly desirable, so that even if they're received out of order they are still legible; something like:

(2) Satoshi Tajiri in 1996, and is centered on fictional creatures called "Pokémon". In Pokémon, humans, known as Pokémon Trainers, catch and train Pokémon to

(3) battle other Pokémon for sport. All media works within the franchise are set in the Pokémon universe. The English slogan for the franchise is "Gotta Catch

(1) Pokémon is a Japanese media franchise managed by The Pokémon Company, a company founded by Nintendo, Game Freak, and Creatures. The franchise was created by

(4) ‘Em All!". There are currently 901 Pokémon species.
mileswwatkins commented 2 years ago

Also to-do is to deal with zero-width joinder emojis and characters that consume more than one character in UCS-2-encoded messages. For example, 👩‍👩‍👦‍👦 is multiple emoji characters merged together into a single pictogram.