Skip to main content

builtin_iconv

Function builtin_iconv 

Source
fn builtin_iconv(
    args: &[RValue],
    named: &[(String, RValue)],
) -> Result<RValue, RError>
Expand description

Convert character strings between encodings.

Supports conversions between UTF-8, Latin-1 (ISO-8859-1), ASCII, and “bytes”. Uses bstr for byte-level manipulation when dealing with non-UTF-8 data.

When sub is provided, it replaces characters that cannot be represented in the target encoding. The special value sub = "byte" uses hex <xx> escapes (matching R’s behavior).

@param x character vector to convert @param from source encoding name (default: “”) @param to target encoding name (default: “”) @param sub substitution string for unconvertible characters (default: NA) @return character vector with converted strings