My .Rmd
file contains multilingual text. When I load the html page produced by knit2html
to my joomla site the multilingual text has been replaced by squares.
Do you know of a way to request a utf-8
encoded html page, or any other way to overcome the problem?
UTF-8 is a valid IANA character set name, whereas utf8 is not. It's not even a valid alias. it refers to an implementation-provided locale, where settings of language, territory, and codeset are implementation-defined.
The first 128 characters in the Unicode library match those in the ASCII library, and UTF-8 translates these 128 Unicode characters into the same binary strings as ASCII. As a result, UTF-8 can take a text file formatted by ASCII and convert it to human-readable text without issue.
Update:
RStudio (>= 0.97.x) and knitr (>= 1.2) know how to handle the file encoding now. RStudio will pass the file encoding to the encoding
argument of knit()
(e.g. knit('foo.Rmd', encoding = 'UTF-8')
). In short, upgrading RStudio and knitr will solve the problem.
Please ignore the answer below; it is no longer an appropriate solution.
I did it like this (using RStudio):
.Rmd
I chose "Save with encoding" then I selected UTF-8
knit2html()
I gave: options(encoding = 'UTF-8')
That did the trick
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With