I think this behavior is inconsistent with the documentation:

  tmp <- 'é'
  tmp <- iconv(tmp, to = 'UTF-8')
  print(Encoding(tmp))
  print(charToRaw(tmp))
  tmpfilepath <- tempfile()
  writeLines(tmp, con = file(tmpfilepath, encoding = 'UTF-8'), useBytes = TRUE)

[1] "UTF-8"
[1] c3 a9

Raw text as hex: c3 83 c2 a9

If I switch to useBytes = FALSE, then the variable is written correctly as  c3 
a9.

Any thoughts? This behavior is related to this issue: 
https://github.com/yihui/knitr/issues/1509


        [[alternative HTML version deleted]]

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to