Skip to main content

decode_auto_into

Function decode_auto_into 

pub fn decode_auto_into(
    input: &[u8],
    dst: &mut String,
) -> Result<(), DecodeError>
Expand description

Encoding-agnostic counterpart to decode_sjis_into: append the decoded UTF-8 to dst, detecting the source encoding.

Same sniffing rule as decode_auto (valid UTF-8 wins, else Shift_JIS), but writes into a caller-owned buffer so corpus loaders can reuse one allocation across many documents. The buffer is not cleared first — see decode_sjis_into.

§Errors

Returns DecodeError::ShiftJisInvalid when the bytes are neither valid UTF-8 nor valid Shift_JIS.