Skip to main content

encode_text

Function encode_text 

Source
pub fn encode_text(text: &str, encoding: &str) -> Result<Vec<u8>, Error>
Expand description

Writes the merged text in the envelope encoding (a skeleton tag from decode_text, or plain "utf-8" / "utf-8-bom"). Text that does not fit the original legacy encoding is written as UTF-8.

A legacy code page result that the same extract would refuse as binary (looks_binary: a merge that shortened a file below its control-byte allowance) is written as UTF-8 instead, which LocOS also writes and which always reads back (legacy_output_or_utf8).