Unicode, Shiny, RStudio, and Windows (example 022-unicode-chinese)
248 views
Skip to first unread message
Jonathan Gilligan
unread,
Apr 2, 2015, 6:34:37 PM4/2/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to shiny-...@googlegroups.com
I have read the article about using Unicode under Windows, but I am still confused about how to make it work. If I check out the shiny-examples from Github and try to run example-022 under RStudio 0.98.1103 with R 3.1.3 under Windows 7, it does not run properly.
When I click "Run App" I get a bunch of error messages in the console like "Warning in checkEncoding(desc) :
The file "shiny-examples/022-unicode-chinese/global.R" is not encoded in UTF-8. Please convert its encoding to UTF-8 (e.g. use the menu `File -> Save with Encoding` in RStudio). " but when I open all the .R files in RStudio and save them with UTF-8 encoding (Menu "File/Save with encoding..."), the errors about not being encoded in UTF-8 persist every time I run the app.
I also get error messages about "Error in fromJSON(content, handler, default.size, depth, allowComments, :
invalid JSON input"
The characters do not display
Can someone give me advice about how to make this example work properly under Windows 7?
Yihui Xie
unread,
Apr 2, 2015, 10:32:34 PM4/2/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Jonathan Gilligan, shiny-discuss
You are recommended to run this app in the Simplified Chinese locale:
you may be able to change it from the control panel of your system.
Without the correct locale, it is difficult for R to read and display
the multi-byte characters in the app.
Regards,
Yihui
Jonathan Gilligan
unread,
Apr 3, 2015, 10:02:23 AM4/3/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to shiny-...@googlegroups.com, jonathan...@gmail.com
I was hoping to write a shiny app that would interact with the user in Bengali, but I don't want to reconfigure my system to use the Bengali locale for the whole OS.
I was hoping that I could just configure things within my Shiny app to interact with the web page in UTF-8 and accept multibyte input from the user without changing the System-wide locale, but from what you way, it sounds like that's not possible under Windows.
Yihui Xie
unread,
Apr 3, 2015, 1:30:49 PM4/3/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Jonathan Gilligan, shiny-discuss
You don't have to change the system locale as long as your system
supports the Bengali locale. You may just change the locale of the R
session by
Sys.setlocale(, 'Bengali')
Then shiny::runApp(). I'm not 100% sure if 'Bengali' is a valid locale
name on Windows, but you can try.