pub fn decode_strict(
bytes: &[u8],
enc: DetectedEncoding,
) -> Result<Cow<'_, str>, ForgeError>Expand description
Strictly decode bytes according to a prior detect verdict.
Only the real leading BOM is stripped (via decode_without_bom_handling for
UTF-16 — Encoding::decode would BOM-sniff again and silently eat a
content U+FEFF in double-BOM files). Any had_errors from encoding_rs
aborts with ForgeError::DecodeError — mojibake is never written.
Truncated BOM payloads are a hard error, never a panic, so the pub API is
safe even when callers pass a verdict that does not match bytes.