Skip to main content

Module utf8

Module utf8 

Source
Expand description

Incremental UTF-8 decoding for byte streams.

Network chunks may split a multi-byte UTF-8 sequence across chunk boundaries. Decoding each chunk independently (e.g. with String::from_utf8_lossy) turns the split character into U+FFFD replacement characters. This decoder holds back an incomplete trailing sequence until the next chunk completes it.

Structsยง

Utf8StreamDecoder
Streaming UTF-8 decoder: feed byte chunks, get valid &str pushed into a String. Truly invalid bytes are replaced with U+FFFD; an incomplete trailing sequence is buffered until more bytes arrive (or Self::flush).