Reputation: 1413
I know it has been adressed several times, but despite many investigations and tries, I have been unabled to solve it so far.
Basically, Rmarkdown fails to render cyrillic characters where there are evaluated in inline code:
---
title: "My Title"
output: html_document
---
### Заказчик
### `r "Заказчик"`
### `r knitr::asis_output("Заказчик")`
produces
My session info is :
> sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19043)
Matrix products: default
locale:
[1] LC_COLLATE=French_France.1252 LC_CTYPE=French_France.1252 LC_MONETARY=French_France.1252 LC_NUMERIC=C
[5] LC_TIME=French_France.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.1.0 fastmap_1.1.0 htmltools_0.5.2 tools_4.1.0 yaml_2.2.1 rmarkdown_2.11 knitr_1.34 xfun_0.26
[9] digest_0.6.28 rlang_0.4.11 evaluate_0.14
Any suggestion ?
Upvotes: 0
Views: 624
Reputation: 3677
Your code works nice.
For the future, create a Rmd-file in the utf-8 encoding.
If you forgot to do that - use "file - > reopen with encoding".
Also, you can use enc2utf8
### Заказчик
### `r enc2utf8("Заказчик")`
### `r knitr::asis_output("Заказчик")`
My session info:
R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
system code page: 1251
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] stringr_1.4.0 ggplot2_3.3.5 dplyr_1.0.7 kableExtra_1.3.4
[5] formattable_0.2.1
Upvotes: 1