Hi Gerrit, > -----Original Message----- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Gerrit Voigt > Sent: Monday, January 19, 2009 4:48 PM > To: r-help@r-project.org > Subject: [R] Sweave encoding problem > > Hello, > Sweave seems to have trouble processing german letters in R. > For example, my noweb R-input looks like this. > <<>>= > Oberflächenfehler = c(4, 11, 6, 2, 7, 9) > @ > If I send it through Sweave, I get the following error message. > > error: chunk 1 > Error in parse(text = chunk) : unexpected input in "Oberflä" > extra: Warning message: > In readLines(f[1]) : > underfull last line in "C:\...." > > (my R is in german, so I needed to translate the error > message myself.) > > I got the impression, that this is an encoding issue of > Sweave, since > the input typed into R directly works just fine. The encoding > I use in > my noweb document is utf8.
I don't think it has something to do with German letters. I saved the following text in a file 'sweavy.Snw': \documentclass{article} \begin{document} Hello World! <<>>= 1+1 @ <<>>= Oberflächenfehler = c(4, 11, 6, 2, 7, 9) @ \end{document} This is what happened in R: > library(utils) > Sweave("sweavy.Snw") Writing to file sweavy.tex Processing code chunks ... 1 : echo term verbatim 2 : echo term verbatim You can now run LaTeX on 'sweavy.tex' > > sessionInfo() R version 2.7.0 (2008-04-22) i386-pc-mingw32 locale: LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base And also the dvi looked fine after processing "latex sweavy.tex" To make things sure, I did in my editor (GNU Emacs 22.1.50.1) C-x RET f utf-8 to change set-buffer-file-coding-system to utf-8. Still works fine. Maybe this helps you further to track down the reason for the problem?!? Best, Roland ---------- This mail has been sent through the MPI for Demographic Research. Should you receive a mail that is apparently from a MPI user without this text displayed, then the address has most likely been faked. If you are uncertain about the validity of this message, please check the mail header or ask your system administrator for assistance. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.