How to display non-English (Japanese/Chinese) characters/text in Shiny on Windows? (NOT ABLE TO ENCODE)

rmarkdown
shiny
rstudio
shinydashboard
r

#1

Hello,

I am not able to display non- English characters in Shiny. Is it a bug in RStudio on Windows? I have tried many ways which I found through internet search but nothing has worked for me. I have even called Sys.setlocale(category="LC_ALL", locale = "en_US.UTF-8") in .Rprofie but still didn't work. I followed all the instructions in https://support.rstudio.com/hc/en-us/articles/200532197-Character-Encoding and http://shiny.rstudio.com/articles/unicode.html hoping to find a solution but no such luck.

Can anyone please help me resolve this issue. I have been working on this for many hours so I am reaching out to this forum hoping to find a solution.

Thanks.


#2

Could you create a minimal reproduce example (reprex) that shows the problem? There are a lot of things which can thwart character display, and a reprex would help narrow down the list. The forums have a guide to help make reprexes: FAQ: What's a reproducible example (reprex) and how do I do one?.

It doesn't need to be long. A shiny app with a single output that mishandles certain characters would work. My quick example:

library(shiny)

shinyApp(
  ui = fluidPage("昨日すき焼きを食べました"),
  server = function(input, output) {}
)

This displays correctly when I run it. My session info after running that code:

sessionInfo()
# R version 3.5.1 (2018-07-02)
# Platform: x86_64-w64-mingw32/x64 (64-bit)
# Running under: Windows >= 8 x64 (build 9200)
# 
# 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    
# 
# attached base packages:
# [1] stats     graphics  grDevices utils     datasets  methods   base     
# 
# other attached packages:
# [1] shiny_1.1.0
# 
# loaded via a namespace (and not attached):
#  [1] compiler_3.5.1  magrittr_1.5    R6_2.2.2        rsconnect_0.8.8 promises_1.0.1 
#  [6] later_0.7.2     htmltools_0.3.6 tools_3.5.1     yaml_2.1.19     Rcpp_0.12.17   
# [11] jsonlite_1.5    digest_0.6.15   xtable_1.8-2    httpuv_1.4.3    mime_0.5

#3

Hi,

This is what exactly I am trying to do. My sessionInfo looks exactly the same. I am not able to display those characters in Windows but I am able to do see in Linux. According to my research in the Internet, I found that this is a bug with RStudio in Windows. Is that true? Is there any solution for this?

Thanks,
Bharath