Module utf8

Module utf8 

Source
Expand description

Conversions between DcList (&[u128]) and UTF-8 (&[u8]).

DcList is a superset format of UTF-8, where values 0..=0x10FFFF directly represent Unicode scalar codepoints, and SHORT_DC_OFFSET (1_114_112) offsets short EITE Document Character IDs. Unmappable DcList values can be encapsulated into UTF-8 using dcl_basenb (base17) armoring, replaced with UTF-8 replacement characters (U+FFFD), or skipped.

Structs§

DcListUtf8Settings
Configuration settings for DcList to/from UTF-8 conversion.

Enums§

DcNormalizationMode
Policy for normalizing Document Characters and Unicode during conversion.

Constants§

DCL_BASENB_END_UUID_RAW
Raw 16-byte array for End UUID: 27efca19-0439-4bec-b58f-dfff5cd8db9f
DCL_BASENB_START_UUID_RAW
Raw 16-byte array for Start UUID: 1880aba3-21df-42b2-9c96-e32cd647ffc5

Functions§

dcl_basenb_end_uuid_bytes
Returns the base17 UTF-8 bytes for the DcList end UUID sentinel.
dcl_basenb_start_uuid_bytes
Returns the base17 UTF-8 bytes for the DcList start UUID sentinel.
dclist_from_utf8
Decodes UTF-8 bytes (&[u8]) into a DcList (Vec<u128>).
dclist_to_utf8
Converts a DcList (&[u128]) into UTF-8 bytes (Vec<u8>).
dcmstr_to_utf8_with_options
Projects a Dc document to UTF-8 using the requested equivalence and unmappable-character policies.
dcmstring_to_dctf
Converts a DcMstring to DcTF bytes.
dcmstring_to_dcutf
Converts a DcMstring to legacy DcUtf bytes.
dcmstring_to_utf8
Converts a DcMstring to UTF-8 bytes in strict mode (without canonicalization of equivalent Dcs).
dcmstring_to_utf8_with_normalization
Converts a DcMstring to UTF-8 bytes with explicit strictness and normalization policy.
dcmstring_to_utf8_with_options
Converts a DcMstring to UTF-8 bytes with permissive or strict options.
dctf_to_dcmstring
Converts DcTF bytes to a DcMstring.
dctf_to_dcmstring_with_options
Converts DcTF bytes to a DcMstring, optionally in permissive mode.
dcutf_to_dcmstring
Converts legacy DcUtf bytes to a DcMstring.
dcutf_to_dcmstring_with_options
Converts legacy DcUtf bytes to a DcMstring, optionally in permissive mode.
normalize_dclist_all
Normalizes all deprecated Document Characters (to their canonical or preferred replacements) and normalizes contiguous Unicode runs to NFC in a DcList.
normalize_dcmstring_all
Normalizes all deprecated Document Characters (to their canonical or preferred replacements) and normalizes Unicode text chunks to NFC in a DcMstr, preserving binary chunks intact.
repair_utf8_encapsulations
Validates legacy UTF-8 encapsulations, repairing damaged payloads only when permissive mode is enabled. Valid text, framing, and binary chunks are preserved without normalization.
utf8_to_dclist
Alias for dclist_from_utf8.
utf8_to_dcmstring
Converts UTF-8 text bytes to a DcMstring.
utf8_to_dcmstring_with_options
Converts UTF-8 text bytes to a DcMstring, optionally in permissive mode.