Crossed errors with Umlauts in ui/server and single-file app

482 views
Skip to first unread message

Dieter Menne

unread,
May 14, 2014, 11:05:14 AM5/14/14
to shiny-...@googlegroups.com

The never-ending encoding story got another twist for me today: on preparing an example, I noted that garbled Umlauts are exactly mirror-errored when using ui/server and single file ( runApp(list()) shiny examples.

For  the ui/server app, try:

runGist("https://gist.github.com/f734287e9ebf4c59806b")

 

For the single-file app, see

https://gist.github.com/8a99754f2ac4c6917cb8.git

sessionInfo() is shown there; this is under Windows 7, German, and latest shiny. Garbled text in one app is good
in the other app, and vice versa
. I have marked good and bad (=Umlaut-garbled) text in the app.

Dieter Menne

unread,
May 16, 2014, 4:06:29 AM5/16/14
to shiny-...@googlegroups.com
Hello, Rstudio´s Shinyists.....

I think this is a bug, and needs a solution or a workaround. Not everyone in this world works with Ascii-Only.

Dieter

Joe Cheng [RStudio]

unread,
May 29, 2014, 5:46:31 PM5/29/14
to shiny-...@googlegroups.com
Hi Dieter, sorry for this problem. Can you try seeing if setting options(encoding="UTF-8") before calling runGist helps?

Dieter Menne

unread,
May 30, 2014, 2:13:24 AM5/30/14
to shiny-...@googlegroups.com


Am Donnerstag, 29. Mai 2014 23:46:31 UTC+2 schrieb Joe Cheng [RStudio]:
Hi Dieter, sorry for this problem. Can you try seeing if setting options(encoding="UTF-8") before calling runGist helps?



> options(encoding="UTF-8") 
> library(shiny)
> runGist("https://gist.github.com/f734287e9ebf4c59806b")
Downloading https://gist.github.com/f734287e9ebf4c59806b/download

Listening on http://127.0.0.1:4904
Warning in readLines(conn) : invalid input found on input connection ''
Warning in readLines(conn) : incomplete final line found on ''

Warning message:
In download.file(url, ...) : downloaded length 622 != reported length 200


Same error for the file with the inverted errors.

Yihui Xie

unread,
Jun 13, 2014, 8:10:15 PM6/13/14
to Dieter Menne, shiny-discuss
Okay, we are trying to put an end to this never-ending encoding
problem under Windows now, and we will really appreciate it if you can
help us test it:

if (!require("devtools")) install.packages("devtools")
devtools::install_github("yihui/shiny@bugfix/windows-encoding")

Note you do not need to set options(encoding="UTF-8") (that may lead
to undesired effects on other I/O functions in R). The only thing you
need to make sure is ui.R/server.R must be UTF8 encoded, which you
have already done in your gist.

Please also note this is still experimental, meaning it is subject to
further changes.

Regards,
Yihui

Dieter Menne

unread,
Jun 14, 2014, 2:32:41 AM6/14/14
to shiny-...@googlegroups.com, menne...@googlemail.com
Am Samstag, 14. Juni 2014 02:10:15 UTC+2 schrieb Yihui Xie:
Okay, we are trying to put an end to this never-ending encoding
problem under Windows now, and we will really appreciate it if you can
help us test it:


I do share your frustration over wasting time for ä and ü, I was close to asking the person asking for this program to use Pre instead of Prä. But it is not a Windows problem alone: In another case, everything went well under Windows and Ubuntu using runApp, and when I switched to Shiny-server on ubuntu, problems restarted.

Not only 

umlautOk = nlevels(na.omit(as.factor(iconv(c("Pre","Prä")))))==2

failed, but generating a 1-page report with knitr trashed 5 Minutes and terminated with an index out of range (2 seconds on runApp(), or with forced Language settings)

Thanks to Jeff Allen and Joe Cheng for their heroic efforts. And thanks to you: For me the output of

runGist("https://gist.github.com/f734287e9ebf4c59806b")

with your modified Shiny version looks good.

Dieter



Yihui Xie

unread,
Jun 14, 2014, 12:24:54 PM6/14/14
to Dieter Menne, shiny-discuss
No, I do not think we were wasting time on supporting non-ASCII
characters. It is certainly very important. The Windows problem and
Shiny Server problem were quite different; the latter has been solved
(it was primarily an environment variable issue that led to a wrong
locale for R), and we just started working on the former. I'm glad
that my patch worked for you under Windows. Thanks!

Regards,
Yihui
Reply all
Reply to author
Forward
0 new messages