Who Knew Email Subjects Are So Complicated
courier.com
courier.com
Something like
encoded_length = 4 * ceil(length / 3) + len(prefix + suffix)
cut_at = floor((desired_length - len(prefix+suffix) / 4) * 3
Then, you should also try to at least cut on a utf8 code-point boundary and maybe handle the whole unicode grapheme something something.