The encoding
function returns "ASCII"
if the entire value
consists of ASCII symbols only, and works identically to
Encoding()
otherwise.
The all_utf8
function is an efficient variant of
all(encoding(x) %in% c("ASCII", "UTF-8"))
.
encoding(x) all_utf8(x)
x | A character vector. |
---|
encoding("a")#> [1] "ASCII"encoding("\u00fc")#> [1] "UTF-8"#> [1] TRUE#> [1] TRUE