[Rd] writeLines argument useBytes = TRUE still making conversions

Davor Josipovic davorj at live.com
Thu Feb 15 08:36:30 CET 2018


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]]



More information about the R-devel mailing list