Specify unicode characters programmatically R

Viewed 2463

In R, you can specify unicode characters by using \u and then a code.

"\u00c3"
[1] "Ã"

What if I already have the "00c3" part as a string, how can I get the unicode?


string <- "00c3"

paste0("\u", string)
#> Error: '\u' used without hex digits in character string starting ""\u"

paste0("\\u", string)
#> [1] "\\u00c3"

eval(paste0("\\u", string))
#> [1] "\\u00c3"

I know about the function rawToChar(), but the raw version of this character is c3 82. How can I get that from 00c3?

1 Answers
Related