RMarkdown utf-8 error in multilevel operating systems

We have a problem using RMarkdown on multiple operating systems.

Initially, a .Rmd file is created on a Linux system (Ubuntu 12.04 LTS) and then redirected to the GitHub repository.

It can be compiled ("knitted") without problems in this system.

Then it is pulled out on a computer running Windows 7 with RStudio installed.

When trying to compile, the following error appears:

Error in yaml::yaml.load(front_matter) : Reader error: invalid leading UTF-8 octet: #FC at 66 Calls: <Anonymous> -> parse_yaml_front_matter -> <Anonymous> -> .Call Execution halted 
  • When you create another .Rmd file on Windows, it works flawlessly.
  • When you create another .Rmd file on Windows and copy everything except the first few lines of the “problem” file to another .Rmd file and compile this file, it works flawlessly.

I compared both files in HEX (in Sublime) on both operating systems: they are EXACTLY the same.

Has anyone else seen this error before?

Refresh . There seems to be a problem with German Umlaut ("ü"), since UFF-8 "Escaped Unicode" is \ uFC, according to http://www.endmemo.com/unicode/unicodeconverter.php

In general, it seems that Unicode is incorrectly recognized by R, RStudio, or knitr on Windows. When I inject some Umlauts into a new .Rmd file and paste it in, I get output like "öää". In RStudio> Tools> Global Options, I set the default encoding to "UTF-8". And I also did it for R, in the RProfile.site file ( options(encoding="UTF-8") ).

Update 2: library(rmarkdown); sessionInfo() library(rmarkdown); sessionInfo() gives

 R version 3.1.2 (2014-10-31) Platform: x86_64-w64-mingw32/x64 (64-bit) locale: [1] LC_COLLATE=German_Switzerland.1252 LC_CTYPE=German_Switzerland.1252 LC_MONETARY=German_Switzerland.1252 [4] LC_NUMERIC=C LC_TIME=German_Switzerland.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] rmarkdown_0.4.2 loaded via a namespace (and not attached): [1] digest_0.6.8 htmltools_0.2.6 tools_3.1.2 

on Windows 7, whereas on Ubuntu this is:

 R version 3.1.2 (2014-10-31) Platform: x86_64-pc-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] rmarkdown_0.3.10 loaded via a namespace (and not attached): [1] digest_0.6.8 htmltools_0.2.6 tools_3.1.2 

I already suspect that the problem is a diverging locale ... how can I fix this?

+5
source share

All Articles