Linked Questions

Popular Questions

I am reading data from an old proprietary database. Unfortunately I end up (only for some strings) with Encoding(mychar_vector) returning "unknown". Unfortunately I am using a wrapper around a closed source c hli (host language interface), so there's probably not much I can do about that – if so I am glad to be proven wrong here...

However, looking at the string vector except for a few replacements I had to make (see my related question) using gsub the strings look ok. I would love to re-gain control of the encoding. Is there a way to forcefully set the encoding to UTF-8? I tried to

Encoding(mychar_vector) <- "UTF-8"
# or
mychar_vector <- enc2utf8(mychar_vector)

But none of this worked out. Just got "unknown" in return immediately after checking. Also looked into iconv but there is obviously no way converting from "unknown" to UTF-8 as there is no mapping.

Is there a way to tell R, that only UTF-8 characters are involved and thus the encoding can be set to UTF-8. Note that some of the elements of the vector are already UTF-8.

Related Questions