Problem with accents when compiling HTML in R-Markdown

3

I have the following problem:

When creating a graph, working from R-Markdown, and when changing the title and in this a special character is included as accents, ñ, etc. I have to change the enconding and place the following instruction: Sys.setlocale("LC_CTYPE", 'en_US.UTF-8') and accept the special characters when running the chunk where the graph appears in the expected way, for example:

But when I compile the HTML using knit, I get the following:

This happens using ggplot, graphs of base R and other graphs provided by other libraries.

How can I fix this issue?

    
asked by Vásquez Carlos 30.08.2018 в 16:56
source

2 answers

0

Everything you use should be in UTF-8 : Application server, php or java or what you use, your html, the encoding of your files or the IDE you use, the collation of the database, the connection to the database. Even APIs or frameworks that you use. If you miss something of that is when the strange characters appear. Look at this thread .

    
answered by 30.08.2018 / 19:13
source
1

The problem was solved as I mention abrahamhs ; specifically writing directly to the console of R (or since RStudio ) Sys.setlocale("LC_ALL", 'en_US.UTF-8’) and Sys.setenv(LANGUAGE="en")

The last code can be changed to: Sys.setenv(LANGUAGE="es")

I am working on macOS High Sierra and if you want to change settings in the console on geolocation, you can see the following league .

    
answered by 14.09.2018 в 01:43