[R] Sweave and uttf-8 under Windows XP

Sven Garbade sfgarbade at googlemail.com
Thu May 20 11:43:23 CEST 2010

Hi list,

I need to process a Rnw file and and a csv file (both are encoded in
UTF-8) under Windows XP  (R Version 2.11.0, i386, mingw32).

I can source and run the Rnw file:

> Stangle("Bericht.Rnw")
Writing to file Bericht.R
> source(file("Bericht.R", encoding="UTF-8"))

which runs fine, but running Sweave() failed:

> Sweave("Bericht.Rnw")
Writing to file Bericht.tex
Processing code chunks ...
 1 : term verbatim
 2 : term verbatim

Fehler:  chunk 2
Error in parse(text = chunk) : Unerwartetes Eingabe in:

My first idea was to run Sweave like Sweave(file("Bericht.Rnw",
encoding="UTF-8")), but Sweave seems to expect a file name as a
character rather a connection. The Rnw and csv file were created under
Linux in a UTF-8 locale and were further processed by xelatex.

Are there any ideas to get Sweave working? I would be nice when the
file encoding can be left in UTF-8.

Thanks, Sven

More information about the R-help mailing list