Skip to main content

Module format

Module format 

Source
Expand description

Encoding and line-ending state for a TextBuffer.

Owns the four format-related fields (current line-ending, original line-ending at load, current encoding, original encoding at load) as a BufferFormat sub-struct composed inside TextBuffer. Exposes pure free functions for detection and conversion so they can be used without constructing any buffer state.

Structs§

BufferFormat
Encoding + line-ending state for one TextBuffer.

Enums§

LineEnding
Line-ending format detected in (or chosen for) a text buffer.

Functions§

convert_to_encoding
Convert UTF-8 content to the specified encoding for saving.
detect_and_convert_encoding
Detect encoding and convert bytes to UTF-8.
detect_encoding
Detect the text encoding from a sample of bytes.
detect_encoding_or_binary
Detect the text encoding and whether content is binary.
detect_line_ending
Detect the line ending format from a sample of bytes
normalize_line_endings
Normalize line endings in the given bytes to LF only.