Brilliant encoding

I am working with RStudio version 0.98.507. Brief information about the initial working tools:

R version 3.1.0 (2014-04-10) Platform: x86_64-w64-mingw32/x64 (64-bit) locale: [1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252 [3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C [5] LC_TIME=German_Germany.1252 other attached packages: [1] shinyapps_0.3.53 RJSONIO_1.2-0.2 shiny_0.9.1.9013 loaded via a namespace (and not attached): [1] bitops_1.0-6 Cairo_1.5-5 caTools_1.17 digest_0.6.4 [5] htmltools_0.2.4 httpuv_1.3.0 Rcpp_0.11.1 RCurl_1.95-4.1 [9] shinysky_0.1.2 tools_3.1.0 xtable_1.7-3 

I have a problem deploying my brilliant application on a brilliant server. The problem was solved at some point, but after it appeared again. Now I can’t fix it. My problem is the German letters in helpers.R . Unfortunately, I cannot avoid using them. I come under my help scrpits helpers.R in server.R , as shown and taught in the Shiny Tutorial. All my R-scripts are carefully saved in UTF-8 format. I can not use the command

 options(encoding="UTF-8") 

because after executing it, the deployApp command ("application") does not work. I set the location using

 Sys.setlocale(category = "LC_ALL", locale = "German") 

It also does not work. I cannot understand why the letters in mainPanel and sidebarLayout are readable, but those from helpers.R are not. Can someone help me solve this paradox?

Example

ui.R

 library(shiny) shinyUI(fluidPage(withMathJax(), titlePanel("Währung"), sidebarLayout(position="right", sidebarPanel( h5("Bedienfenster"), sliderInput('x', 'x axis', value=50, min=3, max=150, step=1,) ), mainPanel( plotOutput("Plot") ) ) )) 

server.R

 shinyServer(function(input, output){ output$Plot <- renderPlot({ x <- rnorm(input$x) hist(x, main="", xlab="", ylab="") title(main="Schätzgerade", xlab="Währung", ylab="Dichte") }) }) 

After deployment, I get the following app .

+8
r utf-8 shiny shiny-server
source share
3 answers

As a workaround (which I haven't tested yet), have you tried using escaped Unicode characters like "W\u00E4hrung" instead of "Währung" ? You can find information on how to do this using ?Quotes , and there is a list of Unicode characters at http://en.wikipedia.org/wiki/List_of_Unicode_characters .

+4
source share

What work for me is to change the encoding of the file (in Rstudio File> Reopen open with encoding) and set the encoding:

  • UTF-8 for ui.R
  • WINDOWS-1252 for .R and global.R server

I don't know the reason, but it did the trick for me.

+1
source share

Brilliant 0.10.1 was released on CRAN, so just install.packages('shiny') . Please ignore the answer below.


We have not yet begun work on the Unicode issue under Windows until recently. Now the problem should be solved, and you can try installing the latest version for development from here:

 devtools::install_github('rstudio/shiny') 

We plan to ship it in brilliant 0.10.1 to be released soon, so we would appreciate it if you could help us check it out. Basically all you have to do is make sure that ui.R and server.R are encoded in UTF-8. You do not need to set options(encoding = 'UTF-8') or escape ä as \u00E4 .

+1
source share

All Articles