Skip to content

This is a convenient way to override the current encoding of a string.

Usage

str_conv(string, encoding)

Arguments

string

Input vector. Either a character vector, or something coercible to one.

encoding

Name of encoding. See stringi::stri_enc_list() for a complete list.

Examples

# Example from encoding?stringi::stringi
x <- rawToChar(as.raw(177))
x
#> [1] "\xb1"
str_conv(x, "ISO-8859-2") # Polish "a with ogonek"
#> [1] "ą"
str_conv(x, "ISO-8859-1") # Plus-minus
#> [1] "±"