datacamp / tutorial

R Package to convert R Markdown files to DataCamp Light HTML files
Other
86 stars 31 forks source link

Problems displaying Arabic characters: set locale to C.UTF-8 by default #27

Open pverkind opened 3 years ago

pverkind commented 3 years ago

Hi, I'm trying to set up a course for text mining of Arabic texts with R.

If I load an Arabic text in a fiddle, it is not rendered correctly in the Console: Arabic letters in the output are rendered as unicode code points between pointed brackets rather than letters (not that Arabic typed in the script is rendered correctly in the console as well):

image

I have found that the problem is with the locale, which is set to "C" by default (on my own machine, it is set to "C.UTF-8"): if I include a line Sys.setlocale(category = "LC_ALL", locale = "C.UTF-8") in the script of the fiddle, it displays correctly:

image

However, if I try to set the locale at the top of the RMarkdown document to C.UTF-8, this does not affect the output of the fiddle - I guess because the locale for the fiddle is on the Datacamp server?

```{r setup, include=FALSE}
tutorial::go_interactive()
Sys.setlocale(category = "LC_ALL", locale = "C.UTF-8")

Would it be possible to set the locale on the datacamp server to C.UTF-8 by default?

NB: I noted that by setting the locale in one fiddle, it also displayed Arabic correctly in another fiddle on the same page.