I need to find a way to replace "\\" by "\" in a string using R. To be more specific, I have text data that is encoded as follows:
text <- c("K\\xc3\\xb6nnen", "S\\xc3\\xbcd")
I want to convert this to UTF-8, which would give the following result:
c("Können", "Süd")
However, the data above has one too many backslashes to convert it, i.e. I need to change the text-vector to:
text_correct <- c("K\xc3\xb6nnen", "S\xc3\xbcd")
Which would make it very easy to encode the data:
library(utf8)
as_utf8(text_correct)
I already googled a lot, but could not find a way to replace "\\" by "\" this using gsub or similar commands. I'm grateful for any help.