I am using R in a windows environment. When i use sink
to direct the output to a file, i can't set encoding to UTF-8.
sink("Umlaute.tex", append=FALSE, split=TRUE)
cat("ÄÖÜäöüß")
sink()
How can I set output encoding to UTF-8?
I am using R in a windows environment. When i use sink
to direct the output to a file, i can't set encoding to UTF-8.
sink("Umlaute.tex", append=FALSE, split=TRUE)
cat("ÄÖÜäöüß")
sink()
How can I set output encoding to UTF-8?
You can open a connection with the correct encoding first and then sink to that connection. That also allows more control how the file is opened.
con <- file("Umlaute.tex", open = "wt", encoding = "UTF-8")
sink(con, split = T)
cat("ÄÖÜäöüß")
sink()
close(con)