I am having an issue where my wordcloud::wordcloud()
renders properly with Chinese characters encoded in UTF-8 when I run my Shiny app locally (Windows 10 machine), but when I deploy it to shinyapps.io
the wordcloud no longer renders properly.
This is the code where I make the wordcloud in my server.R
:
wordcloud_rep <- repeatable(wordcloud)
output$wordcloud <- renderPlot({
wordcloud_rep(word_tab()$word, word_tab()$freq,
min.freq = wordcloud_minfreq(),
max.words = wordcloud_maxwords(),
random.order = FALSE,
colors = brewer.pal(8, "Dark2"))
})
}
However, other Chinese characters in my app deployed on shinyapps.io
show up correctly, as shown here.
I tried setting options(encoding = "UTF-8")
as some people do here, but it does not seem to resolve the issue.
Someone else has had a similar problem with Korean characters, described here.
Does anyone know if it has something to do with rsconnect
, or maybe how the wordcloud
is generated in the wordcloud
package?
EDIT: I used the wordcloud2::wordcloud2()
function instead and it rendered properly without me having to make any other changes.