Expand description
Strict decode / encode / transcode.
Rules enforced here:
- UTF-16 encoders never emit a BOM by themselves —
encodeprepends it manually. - Any decode that reports
had_errorsis a hard error, never a replacement-char pass-through, so mojibake is never written. - No newline normalization —
encoding_rspreserves\r\nverbatim.
Enums§
- Target
Encoding - Encodings the tool can write.
- Transcode
Outcome - Result of transcoding a byte stream.
Functions§
- decode_
strict - Strictly decode
bytesaccording to a priordetectverdict. - encode
- Encode
textintotarget. BOMs forutf-8-bom/utf-16le/utf-16beare prepended manually —encoding_rsnever emits them. - transcode
- Detect + transcode in one call. Prefer
transcode_detectedwhen the detection verdict is already known (avoids a second sniff). - transcode_
detected - Transcode with a pre-computed detection verdict.