-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
支持中文问题 #142
Comments
真是怪哉,_bookdown.yml 含有中文时我在 Windows 下可以加载啊。我再试试。wordcloud2 的问题也等我打开 Windows 试试。 |
试试这里最新版的 bookdown 以及我的 r-ninja 库吧。 |
谢谢大牛! 为虾米动态词云图还是乱码呢?看了一下,用htmlwidget框架传过去的数据都是乱码,将这些字符,在R里转换了一下,用UTF-8转化为GBK就成汉字了。而不用bookdown,用Rmd时画词云不会乱码。。。。 |
5月初我在查这个案子的时候发现了类似的问题 rstudio/rmarkdown#686 刚看了一下,当时我找到的一个解决方案可以解决你的问题,但他们那边的问题还是没能完全解决。待我再研究一下。 |
This fixes rstudio/rmarkdown#686 and rstudio/bookdown#142. The problem in these cases is that `chunks` is encoded in UTF-8 and contains multibyte characters, but `strval`'s encoding is unknown (native). After gsub(useBytes = TRUE), `strval`'s encoding is still unknown, and on Windows, unknown/native != UTF-8, so when the restored HTML is written out, the multibyte characters are garbled.
@WLswert 我找到问题了,在 htmltools 里,请帮忙测试: devtools::install_github('rstudio/htmltools@bugfix/utf8-preserved-chunks') |
@yihui 我这边测试了,问题解决了! |
忒好了! |
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary. |
你好,在window系统环境下,我这边出现以下两个问题。虽然有方法避免,但是还是希望更好的支持中文。
1、用bookdown时在.rmd文档中写中文不会乱码,但是在用wordcloud2包画动态词云图时,中文会乱码。并且不在用bookdown时,用默认的模版可以画出中文词云图。
2、在_bookdown.yml中写入中文,改成UTF-8编码,一直都提示报错:句法分析器1行里不能有多字节字符。且试过其他编码,均无法成功,用yaml::yaml.load()命令测试中文字符串,可以通过,但是会乱码,需要进行转换。
以下是 sessionInfo() 的信息,没有升级3.3.1,因为另外一台电脑是最新版的R与RStudio,上述问题同样存在。
`R version 3.3.0 (2016-05-03)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=Chinese (Simplified)_People's Republic of China.936
[2] LC_CTYPE=Chinese (Simplified)_People's Republic of China.936
[3] LC_MONETARY=Chinese (Simplified)_People's Republic of China.936
[4] LC_NUMERIC=C
[5] LC_TIME=Chinese (Simplified)_People's Republic of China.936
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] magrittr_1.5 R6_2.1.2 rsconnect_0.4.3 htmltools_0.3.5 pbdZMQ_0.2-3
[6] tools_3.3.0 yaml_2.1.13 Rcpp_0.12.5 stringi_1.1.1 rmarkdown_0.9.6.14
[11] stringr_1.0.0 digest_0.6.9 evaluate_0.9 `
The text was updated successfully, but these errors were encountered: