pub fn decode_file(bytes: &[u8]) -> DecodedFileExpand description
Detect the encoding of bytes and decode to UTF-8.
Order: BOM (authoritative) → valid UTF-8 (keeps the common case exact) →
chardetng heuristic. encoding_rs always succeeds (replacement on malformed
input), with had_decode_errors flagging low-confidence results.