0

I installed this package "xaringan". Then I knited the "Ninja Presentation" provided by the “From template” in Rmarkdown, but it failed. The I knited the "Ninja Presentation(Simplified Chinese)" provided by the “From template”, but it also failed.

The error information is as follows:

UTF-8 decoding error in Untitled.knit.md at byte offset 13 (bb).
The input must be a UTF-8 encoded text.
Error: pandoc document conversion failed with error 92
Execution halted

I made many attempts to solve this problem, but failed

1.Surely, I knited the original PPT, PDF and Html in Rmarkdown, It ran successfully. But this package "xaringan" in my win10 system is not work.

2. `xfun::session_info('rmarkdown')\*\*`

    R version 4.1.2 (2021-11-01)
    Platform: x86_64-w64-mingw32/x64 (64-bit)
    Running under: Windows 10 x64 (build 19043), RStudio 2021.9.0.351

    Locale:
    LC_COLLATE=Chinese (Simplified)\_China.936  LC_CTYPE=Chinese (Simplified)\_China.936  
    LC_MONETARY=Chinese (Simplified)\_China.936 LC_NUMERIC=C  
    LC_TIME=Chinese (Simplified)\_China.936
    
    Package version:
    base64enc_0.1.3 bslib_0.3.1     digest_0.6.29   evaluate_0.15   fastmap_1.1.0   fs_1.5.2        glue_1.6.2  
    graphics_4.1.2  grDevices_4.1.2 highr_0.9       htmltools_0.5.2 jquerylib_0.1.4 jsonlite_1.8.0  knitr_1.37  
    magrittr_2.0.2  methods_4.1.2   R6_2.5.1        rappdirs_0.3.3  rlang_1.0.2     rmarkdown_2.13  sass_0.4.0  
    stats_4.1.2     stringi_1.7.6   stringr_1.4.0   tinytex_0.37.2  tools_4.1.2     utils_4.1.2     xfun_0.30  
    yaml_2.3.5
    
    Pandoc version: 2.14.0.3

3.I have successfully executed the following command, but package "xaringan" still fails

remotes::install_github('yihui/knitr', upgrade = TRUE)
update.packages(ask = FALSE, checkBuilt = TRUE)

4.I installed a package “xaringanthemer”,then knited the "Ninja Themed Presentation" provided by the “From template” in Rmarkdown. It kinted successfully.But the package "xaringan" is still not work. It's strange!

I really appreciate your help!

Nad Pat
  • 3,129
  • 3
  • 10
  • 20
Steven
  • 33
  • 3

1 Answers1

1

The error message says it failed because "The input must be a UTF-8 encoded text." That's not the default on Windows, so you need to work out how to get the file into that encoding.

There are two possibilities. First, it might be that your input file is not in UTF-8. You should be able to ask whatever editor you are using to save it in that format. In RStudio, you use File | Save with encoding... and choose UTF-8.

That might not be sufficient. In versions of R on Windows prior to the upcoming 4.2.0, a lot of output is automatically changed to the default encoding, which is not UTF-8. You could try installing the development build from https://cloud.r-project.org/bin/windows/base/rdevel.html . That version should handle UTF-8 much more smoothly. If you do install it, you should probably also update RStudio; I'm not sure your version is compatible with the new R.

user2554330
  • 37,248
  • 4
  • 43
  • 90
  • Hi!Your suggestions can solve this problem for me. I am truly grateful to you for what your suggsetions – Steven Mar 23 '22 at 02:59