[Rd] Output mis-encoded on Windows w/ RGui 3.5.1 in strange case

Kevin Ushey kevinu@hey @ending from gm@il@com
Mon Jul 16 22:01:50 CEST 2018


Given the following R script:

   x <- 1
   print(list())
   save(x, file = tempfile())
   output <- encodeString("apple")
   print(output)

If I source this script from RGui on Windows, I see the output:

   > source("encoding.R")
   list()
   [1] "\002ÿþapple\003ÿþ"

That is, it's as though R has injected what looks like byte order
marks around the encoded string:

   > charToRaw(output)
    [1] 02 ff fe 61 70 70 6c 65 03 ff fe

FWIW I see the same output in R-patched and R-devel. Any idea what
might be going on? For what it's worth, I don't see the same issue
with R as run from the terminal.

Thanks,
Kevin



More information about the R-devel mailing list