Encoding problem with bookdown


#1

Hi,

I have a problem when compiling a bookdown book in 2 different systems:

  1. on my linux laptop (Mint 18.1), I use RStudio to compile my book.
  2. on the production linux servers (CentOS Linux release 7.2.1511), I do not have RStudio and compile the book from a R shell using: bookdown::render_book('index.Rmd', "bookdown::gitbook", encoding='UTF-8')

The gitbook output from 1. is fine and is rendered without a hitch in my web browser.
The gitbook output from 2. has encoding problems. For example, "user's guide" is transformed into "userĂ¢s guide" in the html.

To test if I could reproduce the problem on my laptop, I have tried to compile from a R shell but this failed as the pandoc package that is installed is too old... working on this now.

In the meantime, I would appreciate any pointers to solve the encoding problem happening on my production server.

Thank you


#2

Update:
After upgrading to Linux 18.3, I now have pandoc 2.3.1 installed on my laptop. Compilation from R using bookdown::render_book('index.Rmd', "bookdown::gitbook", encoding='UTF-8' results in the correct html encoding (ie, user's guide).

Session info on laptop:

R version 3.4.4 (2018-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 18.3

Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.6.0
LAPACK: /usr/lib/lapack/liblapack.so.3.6.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] 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   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] compiler_3.4.4  backports_1.1.1 magrittr_1.5    bookdown_0.7   
 [5] rprojroot_1.2   htmltools_0.3.6 tools_3.4.4     rstudioapi_0.7 
 [9] yaml_2.1.14     Rcpp_0.12.18    stringi_1.1.5   rmarkdown_1.7  
[13] knitr_1.20      stringr_1.2.0   digest_0.6.12   xfun_0.3       
[17] evaluate_0.10.1

Session info on production server:

R version 3.4.3 (2017-11-30)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS: /usr/lib64/R/lib/libRblas.so
LAPACK: /usr/lib64/R/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] 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
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

loaded via a namespace (and not attached):
 [1] compiler_3.4.3  backports_1.1.2 magrittr_1.5    bookdown_0.7
 [5] rprojroot_1.3-2 htmltools_0.3.6 tools_3.4.3     rstudioapi_0.7
 [9] yaml_2.1.18     Rcpp_0.12.16    stringi_1.1.7   rmarkdown_1.9
[13] knitr_1.20      stringr_1.3.0   digest_0.6.15   xfun_0.3
[17] evaluate_0.10.1