# the second element is encoded in latin-1, but declared as UTF-8
x <- c("fa\u00E7ile", "fa\xE7ile", "fa\xC3\xA7ile")
Encoding(x) <- c("UTF-8", "UTF-8", "bytes")
# encoding
utf8_encode(x)
# add style to the escapes
cat(utf8_encode("hello\nstyled\\world", escapes = "1"), "\n")
Run the code above in your browser using DataLab