Skip to main content

case_space_encode

Function case_space_encode 

Source
pub fn case_space_encode(input: &[u8]) -> Vec<u16>
Expand description

Applies Fabrice Bellard’s reversible case-and-space encoding to raw input bytes.

Word runs are lowercased with space-elision and case markers (CH_NO_SPACE, CH_TO_UPPER, CH_FIRST_UPPER), returning a u16 symbol buffer whose values are in 0..=255.

Matches preprocess.c verbatim (including its quirk that a single leading ASCII space at byte 0 followed by a word is absorbed by the decoder’s initial has_space = false).