Expand description
Text handling for display text (draft-atwood-jmap-updates-00 §6).
truncate_graphemes: shorten text at an extended grapheme cluster boundary (UAX #29) within an octet limit (§6.5), for previews, notification bodies and push payloads.check_display_text: the display-text profile of §6.2 (the one- and two-dimensional Modern Network Unicode rules). It is a SHOULD on content and a MAY for rejection; the crates offer the check and do not enforce it by default (gap G4 indocs/design/updates.md).
Servers SHOULD NOT normalize text they store and return (§6.3), and SHOULD give display text no meaning (§6.4): nothing here normalizes.
Structs§
- Display
Text Error - Why a string breaks the display-text profile of draft-atwood-jmap-updates-00 §6.2.
Functions§
- check_
display_ text - Check
sagainst the display-text profile of draft-atwood-jmap-updates-00 §6.2: no control characters U+0000 to U+001F and U+007F to U+009F (except U+000A LINE FEED whenmultiline, so lines end with LF alone and CR is rejected), no U+2028 LINE SEPARATOR or U+2029 PARAGRAPH SEPARATOR, no noncharacters U+FFFE and U+FFFF, and no leading U+FEFF byte order mark. - truncate_
graphemes - The longest prefix of
sthat is at mostmax_octetsbytes of UTF-8 and ends at an extended grapheme cluster boundary (UAX #29), so no code point, combining sequence, emoji sequence or Hangul syllable is split (§6.5). Returnssunchanged when it already fits; the empty string when even the first cluster does not. - truncate_
graphemes_ chars truncate_graphemesfor a limit in characters (Unicode scalar values) rather than octets, as the RFC 8621 §4.1.4 Emailpreview(“up to 256 characters”) states it: the longest prefix of at mostmax_charscharacters that ends at a grapheme cluster boundary.