4

So far I was using combination of R + Rstudio + knit (to mostly HTML) in english so perhaps that's why I never stumbled on this issue. Recently, however, I started writing a doc in polish and noted that whether I knit to HTML or PDF, the text loses polish symbols. So in example the following sentence:

Warto podkreślić, że zaznaczona na osi wartość...

Is rendered as this:

Warto podkreslic, ze zaznaczona na osi wartosc...

And - just for your curiosity - in english it means:

Worth to point out, that the value marked on axis...

This is extremely troublesome. I checked that the original file is encoded in UTF-8 so correctly. I checked that all settings in Rstudio are set to utf-8 as well. Going through the call I'd also say it should work as UTF-8 so I'm puzzled what's wrong.

Now as I'm writing this question, I tested that when I i.e. produce graph in R (graph is in ggplot2) without knitting the document, it also loses polish symbols. Perhaps the issue is with R itself and not a fault of knit then? Is it even possible to encode a doc in R properly or is it latin1 or nothing?

I'm not sure what additional information I should provide to help you determine what's wrong. I'm running on Windows 10.

nimdil
  • 1,361
  • 10
  • 20
  • Very interesting. It looks like `pandoc` strips the accent. Just `knit`ting a document with accents keeps them, but with the "Knit HTML" button in RStudio, which knits the document and converts it afterwards, accents are lost. – CL. Nov 24 '15 at 14:47
  • If that's the case why ggplot2 histogram loses non-ascii letters from labels - this is done fully within RStudio without knitting (so I guess I can reproduce it easily outside RStudio in pure R env.)? – nimdil Nov 25 '15 at 15:51
  • Have you tried the development version of knitr https://github.com/yihui/knitr? – Yihui Xie Nov 30 '15 at 22:54

0 Answers0