[Issue] Encode / Decode : Running `chunk` and `knit` documents

Continuing the discussion from What is the difference between running chunk and knitting it?:

Please ask your questions about R Markdown here.

Running chunk smoothly and don't shows any error but errors appears when knit documents, try to set both Sys.setlocale("LC_CTYPE", "en_US.UTF-8") and Sys.setlocale("LC_CTYPE", "zh_CN.UTF-8") do not work... (Besides, installed Anbox on Linux :penguin:, biden_mem working fine but ash_mem doesn't work), greek symbol xi ξ, ® and chinese language characters cannot be decoded when knitted to document...

I don't have any personnel problem, just wonder why merely update resume... @@"


Are you on Windows ? You mention "Anbox on Linux" but not sure if that means you are using R on Linux or not.

I ask because it is possibly related to

This would be due to R being non-UTF8 by default on Windows. But this will change in next R version (currently R devel) and should solve it.

If you are not on Windows, can you share a reproducible example ? File should be encoding to UTF-8 and all supported characters should work fine. Unless there is something in the chain, like does it happens only with echart4r or any content using those chars ?

englianhu@ScibrokesTrading:~$ neofetch
            .-/+oossssoo+/-.               englianhu@ScibrokesTrading 
        `:+ssssssssssssssssss+:`           -------------------------- 
      -+ssssssssssssssssssyyssss+-         OS: Ubuntu 20.04.3 LTS x86_64 
    .ossssssssssssssssssdMMMNysssso.       Host: 23-p080d 
   /ssssssssssshdmmNNmmyNMMMMhssssss/      Kernel: 5.16.5-051605-generic 
  +ssssssssshmydMMMMMMMNddddyssssssss+     Uptime: 7 hours, 1 min 
 /sssssssshNMMMyhhyyyyhmNMMMNhssssssss/    Packages: 4841 (dpkg), 36 (snap) 
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Shell: bash 5.0.17 
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   Resolution: 1920x1080 
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   DE: Plasma 
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   WM: KWin 
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   WM Theme: CurvedVolatile 
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Theme: Genome D. Charoite [Plasma], Breeze  
 /sssssssshNMMMyhhyyyyhdNMMMNhssssssss/    Icons: Shiny-Dark-Icons [Plasma], Shiny-Dar 
  +sssssssssdmydMMMMMMMMddddyssssssss+     Terminal: konsole 
   /ssssssssssshdmNNNNmyNMMMMhssssss/      CPU: Intel i5-4590T (4) @ 3.000GHz 
    .ossssssssssssssssssdMMMNysssso.       GPU: NVIDIA GeForce 710M 
      -+sssssssssssssssssyyyssss+-         GPU: Intel HD Graphics 
        `:+ssssssssssssssssss+:`           Memory: 7247MiB / 15893MiB 
+englianhu@ScibrokesTrading:~$ sudo apt install r-base-dev*
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'r-base-dev' for glob 'r-base-dev*'
+r-base-dev is already the newest version (4.1.2-1.2004.0).
r-base-dev set to manually installed.
The following packages were automatically installed and are no longer required:
  appmenu-gtk-module-common libappmenu-gtk3-parser0 linux-image-5.11.0-46-generic
  linux-modules-5.11.0-46-generic linux-modules-extra-5.11.0-46-generic
  linux-signatures-nvidia-5.11.0-46-generic r-cran-conquer
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

suppressMessages(require('formattable', quietly = TRUE))
suppressMessages(require('knitr', quietly = TRUE))
suppressMessages(require('kableExtra', quietly = TRUE))
suppressMessages(require('magittr', quietly = TRUE))
suppressMessages(require('devtools', quietly = TRUE))

sys1 <- session_info()$platform |> 
    unlist() |> 
    {\(.) data.frame(row.names = 1:length(.), 
                     Category = names(.), session_info = .)}()

sys2 <- data.frame(Sys.info()) |> 
    {\(.) data.frame(Category = row.names(.), Sys.info = .[,1])}()

#remarks, dim(sys1), dim(sys2)
if (nrow(sys1) == 11 & nrow(sys2) == 8) {
  sys2 <- sys2 |> 
    {\(.) rbind(., data.frame(
    Category = c('rmarkdown', 'rsconnect', 'Current time'), 
    Sys.info = c(as.character(getwd()), 
                 paste(as.character(lubridate::now('Asia/Shanghai')), 'CST 🗺'))))}()
} else if (nrow(sys1) == 10 & nrow(sys2) == 8) {
  sys1 %<>% rbind(., data.frame(Category = '', session_info = ''))
  sys2 <- sys2 |> 
    {\(.) rbind(., data.frame(
    Category = c('rmarkdown', 'rsconnect', 'Current time'), 
    Sys.info = c(as.character(getwd()), 
                 paste(as.character(lubridate::now('Asia/Shanghai')), 'CST 🗺'))))}()

sys <- cbind(sys1, sys2) |> 
    kbl(., caption = 'Additional session information:')}() |> 
    kable_styling(., bootstrap_options = c('striped', 'hover', 'condensed', 'responsive'))}() |> 
    row_spec(., 0, background = 'DimGrey', color = 'yellow')}() |> 
    column_spec(., 1, background = 'CornflowerBlue', color = 'red')}() |> 
    column_spec(., 2, background = 'grey', color = 'black')}() |> 
    column_spec(., 3, background = 'CornflowerBlue', color = 'blue')}() |> 
    column_spec(., 4, background = 'grey', color = 'white')}() |> 
    row_spec(., 11, bold = TRUE, color = 'yellow', background = '#D7261E')}()

rm(sys1, sys2)

Knitted Document shows as above UI = X11 etc.

Running Chunk shows as above UI=RStudio & Ghost Orchid (Desktop) Version.

Somebody take a look on the Asian language and Symbols encode/decode UTF-8 issue? It's working fine few months ago before I formatted my OS Kubuntu :gear: --- Linux :penguin:...

We all Non-Malay (Non-Eunice and only wizard need Islamic Malay since the wizard Teo & Law don't understand Arabian language), it working fine since last week when set the Sys.setlocale("LC_ALL", "en_US.UTF-8"), used to mention only owner project affected but wonder why here the problem came again... Somebody take a look?

Somebody from RStudio :handshake:🏻 Linux :penguin: tuned it and working fine as per link below...


Currently remarks pronounciation on Japanese (Kanji汉字/hiragana平假名)version words through RT (RubyText) to tidy the CV as per link below...


Before RT

After RT

1 Like

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.