Crate ctb_formats_utf8

Crate ctb_formats_utf8 

Source
Expand description

UTF-8 character encoding, validation, and stream parsing utilities.

Constants§

UTF8_REPLACEMENT_CHARACTER

Functions§

ellipsize_to_max_bytes
Ellipsize a string to a maximum byte length, respecting UTF-8 boundaries.
first_char_of_utf8_string
Return a character (or for invalid part of the string, the replacement character) of a UTF-8 string as bytes, as well as the number of input bytes consumed. For valid UTF-8 input, the number of input bytes will always match the number of output bytes.
first_char_of_utf8_string_lossless
Return a character or invalid part of a UTF-8 string as bytes, as well as the number of input bytes consumed.
to_ascii_translit
Roughly transliterate a UTF-8 string to ASCII. I have in mind a new transliteration “transformation” (defined in transformations.csv) which could be applied in some general way as a fallback encoding handler (that isn’t a concept that exists anywhere in code yet, but basically a generalization of the “replacement character” idea where a Dc format chain could be defined to perform more complex conversion operations on text during an export).
truncate_to_max_bytes
Truncate a string to a maximum byte length, respecting UTF-8 boundaries.
utf8_from_scalar