yihui/formatR — Issue #13: Unable to format text with unicode characters.
Author: leonbaum
Created: 2011-11-24 04:20:38+00:00
State: open

Hi, I just discovered knitr (which is awesome btw!), and it seems to have problems with unicode characters in code chunks. I think that the problem is because of formatR:

> formatR:::tidy.source(text = "σ <- 2")
Unable to parse the R code! The error most likely came from line 1;
the surrounding lines are:
############################################################
σ <- 2
############################################################
See the reference in help(tidy.source) for possible reasons

Error in formatR:::tidy.source(text = "σ <- 2") :
Error in parser(text = text.lines) :
/tmp/RtmpSn34lJ/file1b53bfb1:1:0
unexpected input

> Sys.getlocale()
[1] "LC_CTYPE=en_US.utf8;LC_NUMERIC=C;LC_TIME=en_US.utf8;LC_COLLATE=en_US.utf8;LC_MONETARY=en_US.utf8;LC_MESSAGES=en_US.utf8;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.utf8;LC_IDENTIFICATION=C"