
Apply enc2native()
to the character vector, and check if
enc2utf8()
can convert it back without a loss. If it does, return
enc2native(x)
, otherwise return the original vector with a warning.
native_encode(x)
A character vector.
# NOT RUN {
library(xfun)
s = intToUtf8(c(20320, 22909))
Encoding(s)
s2 = native_encode(s)
Encoding(s2)
# }
Run the code above in your browser using DataLab