SMSLEN(1)
๐ smslen(1): the smol guide to SMS payload math ๐
okay so bestie, welcome to smslen โ a Gen Z safe space for Calculate SMS message payload length. yes that's the whole name section, slay โจ
๐ SYNOPSIS ๐
like, three ways to run this icon:
smslen [-i encoding] [filename]
smslen -r limit [-i encoding] [filename]
smslen -t limit [-i encoding] [filename]
๐ DESCRIPTION ๐
smslen crunches the numbers on how many bytes of SMS payload your input text is gonna eat up. it's giving calculator but make it text. ๐งฎโจ
here's the algorithm's whole personality: first it tries to encode the input with GSM 03.38, which needs seven or 14 bits per character โ the 14 is for the ``extension'' characters, fyi, they're extra like that. but plot twist ๐ญ only certain commonly-used characters are even encodable in GSM 03.38, so the moment it spots even ONE unsupported character, it gives up and reverts to UTF-16 encoding for the entire message โ the whole thing, no partial situation โ which means 16 bits per character. no cap, one weird character and the whole vibe shifts. ๐
the first form just prints the number of bytes required to encode the input. that's it, that's the tea.
the -r form is the same math but flipped, lowkey inverted โ it prints the number of input bytes that will fit under the given encoded length limit. and because the SMS payload limit is 140 bytes, running -r 140 tells you exactly how much of your input fits in a single SMS message. iconic for when you're texting someone and gotta know if it's one bubble or two. ๐ซถ
the -t form does the same calculation as the -r form but actually copies the input to the output, truncating it the moment the calculated limit number of encoded output bytes is reached. so it's like -r but it hands you the actual trimmed text instead of a number. she does both, she's versatile. ๐
โจ OPTIONS โจ
-iโ specify the input character encoding. bestie, by default UTF-8 is assumed, so you only need this if you're being spicy.-r limitโ output the number of input bytes that, when encoded into an SMS payload, will have a length at most limit. (math, but make it fashion ๐ )-t limitโ copy the input to the output right up until the encoded length would reach limit. truncation station, next stop: your screen ๐-hโ output the usage message and exit. the classic "what does this even do" button, we love her.
๐ EXIT STATUS ๐
smslen exits zero normally โ good vibes, no notes. but it'll exit 1 if an error occurs. ๐ญ
possible errors include an invalid byte sequence in the input. so if you feed it garbage bytes, don't be surprised when it's like "nope" and bails. ๐ฉ
fr fr, garbage in = exit code 1 out. be careful what you pipe into her.
๐ฆ SEE ALSO ๐ฆ
the whole friend group: twimsg(1), twils(1), twirm(1), twiping(1), twilog(1). squad goals. ๐ซถ
also the reading list, because she's well-read:
- Adventures in Unicode SMS, http://www.twilio.com/engineering/2012/11/08/adventures-in-unicode-sms.
- Wikipedia: GSM 03.38, http://en.wikipedia.org/wiki/GSM_03.38.
the links are literally copied character for character, go read them, iykyk. ๐
๐ AUTHOR ๐
Archie L. Cobbs <archie.cobbs@gmail.com> โ the main character who wrote this. respect the icon. ๐
๐ and that's the whole page, bestie ๐
this little love letter to the manpage universe was brought to you by Debian, dated May 17, 2013 โ vintage, retro, still slaying. mwah ๐๐ธ
๐ฆ where this page comes from
- opensuse-leap 16.0: twilio-utils 1.2.2-bp160.1.12 ยท Apache-2.0
- opensuse-leap 16.0: twilio-utils 1.2.2-bp160.1.12 ยท Apache-2.0
- opensuse-leap 16.0: twilio-utils 1.2.2-bp160.1.12 ยท Apache-2.0
- opensuse-leap 16.0: twilio-utils 1.2.2-bp160.1.12 ยท Apache-2.0
- Copyright 2013 Archie L. Cobbs <archie.cobbs@gmail.com>
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms