Chinese comments are not supported in bs4_book?

According to https://bookdown.org/yihui/bookdown/html.html#bs4-book,
I use the RStudio (File > New Project > New Directory > Book project using bookdown) and select bs4_book, then write a new bs4_book:

i add a R code with english comments

```{r}
#  Sequence
1:5
```

try this

bookdown::render_book("index.Rmd")

it work correctly.

However, when i add a R code with chinese comments

```{r}
#  序列
1:5
```

I got this error.

Error in gsub("<U+2029>", "\033", text[is_comment], fixed = TRUE)
> xfun::session_info('bookdown')
R version 4.0.5 (2021-03-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19043), RStudio 2021.9.0.338

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 bookdown_0.24.1 digest_0.6.27   evaluate_0.14  
  fastmap_1.1.0   glue_1.4.2      graphics_4.0.5  grDevices_4.0.5
  highr_0.9       htmltools_0.5.2 jquerylib_0.1.4 jsonlite_1.7.2 
  knitr_1.33      magrittr_2.0.1  markdown_1.1    methods_4.0.5  
  mime_0.11       rlang_0.4.11    rmarkdown_2.10  stats_4.0.5    
  stringi_1.7.4   stringr_1.4.0   tinytex_0.33    tools_4.0.5    
  utils_4.0.5     xfun_0.25       yaml_2.2.1     
> sessioninfo::platform_info()
 setting  value                         
 version  R version 4.0.5 (2021-03-31)  
 os       Windows 10 x64                
 system   x86_64, mingw32               
 ui       RStudio                       
 language (EN)                          
 collate  Chinese (Simplified)_China.936
 ctype    Chinese (Simplified)_China.936
 tz       Asia/Taipei                   
 date     2021-09-08

I believe this is an issue in bookdown and it seems that bs4_book() format does not support well Chinese character (and maybe any language with UTF-8 or special characters).

Can you open an issue with a reproducible examples (or steps) ?

Thank you

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.