I have an app that I'd like to deploy shinyapps.io, and am using the standard procedure (described here) to try and deploy it. Unfortunately, I keep getting this error message.
After a few hours of debugging, I'm fairly sure that this happens because I try and read in a .csv file that contains non-ASCII characters (German Umlaute, e.g. Ä). I have tried the options described here (i.e. saving all relevant scripts and .csv files as UTF-8 files, as well as explicitly setting the encoding options to UTF-8 before deploying the app).
What else can I try, short of simply changing the characters in my CSV files (which I would really like to avoid)?
Thanks so much for your help!
An attempt at a minimal reproducible example is here.
The app code is here:
library(shiny)
library(formattable)
library(readxl)
fp = read.csv("./with1.csv",stringsAsFactors = FALSE,strip.white = TRUE)
ui <- fluidPage(
mainPanel(
formattableOutput("t1"),
tags$style("#t1 {color:steelblue;}"),
tableOutput("t2")
)
)
server <- function(input, output, session) {
output$t2 = renderTable({
fp
})
output$t1 = renderFormattable({
test = as.data.frame(matrix(ncol=4,nrow=1))
colnames(test) = c("Price","Avy Risk","Tomorrow / This Week","Drive Time")
test[1,]=c(paste("\U20AC","29"),"2","26cm/ 85cm","3h45m")
formattable(test,
align = c("c","c","c","c"),
list(`Price` = formatter("span", style = ~ style(font.weight = "bold",color="#4187FF",
border = "1px solid #4187FF",border.radius="4px",
padding="3px")),
`Avy Risk` = formatter("span", style = ~ style(font.weight = "bold",color="#FF705A",
border = "1px solid #FF705A",border.radius="4px",
padding="3px")),
`Tomorrow / This Week` = formatter("span", style = ~ style(font.weight = "bold",color="#5cb85c",
border = "1px solid #5cb85c",border.radius="4px",
padding="3px")),
`Drive Time` = formatter("span", style = ~ style(font.weight = "bold",color="#C13BFF",
border = "1px solid #C13BFF",border.radius="4px",
padding="3px"))
)
)
})
}
shinyApp(ui, server)
The fp dataset (saved in an excel.csv file) looks like this:
[![enter image description here][4]][4]
After properly connecting RStudio to RSConnect, my deploy statement looks like this:
options(encoding = "UTF-8")
rsconnect::deployApp('C:/Users/fiscs14/Desktop/PowderHound/test')
I hope that this example is somewhat easily reproducible, and gives you an idea of the issue I'm running into.