Expand description
Text length and UTF-8-safe truncation helpers.
Aster services often need conservative limits for display text, file names, status messages, or external-system error snippets. This module keeps byte-based truncation UTF-8-safe and provides a small character-count helper for product validation rules that are expressed in Unicode scalar values instead of bytes.
Functionsยง
- char_
count - Returns the number of Unicode scalar values in a string.
- truncate_
utf8_ to_ max_ bytes - Truncates a string to at most
max_bytesbytes without splitting a UTF-8 code point.