encode_file

Function encode_file 

Source
pub fn encode_file(
    content: &str,
    encoding_label: &str,
    bom: &str,
    line_ending: &str,
) -> (Vec<u8>, bool)
Expand description

Encode editor text (\n-delimited UTF-8) back to bytes in encoding_label, applying bom and line_ending. Returns the bytes to write plus whether any character was unmappable in the target encoding (the caller may warn).

encoding_label falls back to UTF-8 when unknown/empty, so existing callers that don’t pass an encoding keep writing UTF-8.