Skip to content
Prev 167955 / 398503 Next

Sweave encoding problem

Gerrit Voigt wrote:
Connections and functions that read from them generally have an 
"encoding" argument; I think you need to have that set to "UTF-8" or 
"latin1" as appropriate.  However, Sweave() doesn't offer an option to 
pass that arg down to the readLines() call that actually reads the 
file.  I believe options(encoding="UTF-8") or options(encoding="latin1") 
will set the default if you run it before calling Sweave. 

You will probably find it frustrating to keep switching that option; I'd 
recommend storing files in the native encoding for your system, which R 
will default to using.  (This doesn't work if you share the same file on 
multiple systems, of course.)

Duncan Murdoch