3

I've struggling a lot with this problem since last week: I am using R presentation (.Rpres file) for the first time and it started alright, meaning that I could build a slide and visualize the result in the Presentation tab in RStudio. However, for reasons I don't understand, after a few hours of working on my presentations the Presentation tab began to show weird symbols for all the french characters in my presentation. The only way so far I could get the presentation back to showing the right characters was by playing with the "Save with encoding..." and "Reopen with encoding..." options in Rstudio.

The problem is that although this has made the french characters in the presentation look good, it is now the text in the source file (.RPres) that looks all weird (e.g. "température" instead of "température").

Here is some more details on my setup, if this can help:

> sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=French_Canada.1252  LC_CTYPE=French_Canada.1252    LC_MONETARY=French_Canada.1252
[4] LC_NUMERIC=C                   LC_TIME=French_Canada.1252    

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

other attached packages:
 [1] readxl_0.1.1     sp_1.2-2         foreign_0.8-66   data.table_1.9.6 dplyr_0.4.3      bit64_0.9-5     
 [7] bit_1.1-12       RPostgres_0.1    DBI_0.3.1.9008   Rcpp_0.12.3.2   

loaded via a namespace (and not attached):
[1] lattice_0.20-33 assertthat_0.1  chron_2.3-47    grid_3.2.3      R6_2.1.2        magrittr_1.5   
[7] tools_3.2.3     parallel_3.2.3 

I really hope someone will find a solution to this as I like this tool and would like to keep using i in the future. I was thinking of trying the revealjs package as an alternative to fix my problem but I haven't (not sure I won't have the same problem). Thanks for your help.

IRTFM
  • 258,963
  • 21
  • 364
  • 487
Guilôme
  • 177
  • 2
  • 11
  • Rstudio users seem to think that everyone uses the same IDE. This notion is not yet TRUE. – IRTFM Apr 10 '16 at 22:42
  • @42: I'm not sure I understand your comment. Do you mean I should have posted this in the RStudio forum? I believe SO gets more chances of being read and I tagged my post accordingly. – Guilôme Apr 11 '16 at 01:21
  • No, I just didn't think it was properly tagged as [r]. – IRTFM Apr 11 '16 at 02:52

1 Answers1

0

This problem might be related to the locale specified for your computer, as explained here: https://superuser.com/questions/655273/r-locale-setting-problems-on-mac-os-x

If the result of system("locale") contains a lot of values "C", then you should try the command

system("defaults write org.R-project.R force.LANG en_US.UTF-8")  

After this, you should restart R and use system("locale") to check that the locale has been updated, and hopefully you should now be able to get the correct characters the next time you compile your document.

Note: I know that this strategy has solved a similar problem for users on Linux and OS X, but I don't know if it also works if your OS is Windows.

Community
  • 1
  • 1
  • On Windows systems, there is no `locale` command. The equivalent is `systeminfo`. I tried it and I don't see many "C". I have "fr-ca" System Regional Options and "en-ca" as Regional Input Parameters. Meanwhile, I switched to using the R package revealjs and my problem is solved! Thanks for helping. – Guilôme Apr 11 '16 at 18:18