utf - 8 file names downloading files from shiny to a windows

126 views
Skip to first unread message

eliav schmulewitz

unread,
Feb 1, 2016, 1:22:13 AM2/1/16
to Shiny - Web Framework for R
i admit this is cross posting, i got no response from SO if you want the points here is the link: http://stackoverflow.com/questions/35112985/utf-8-file-names-downloading-files-from-shiny-to-a-windows

I am running a shiny app with many Hebrew characters 
I have no problem seeing the hebrew or downloading Hebrew characters in an excel file or as part of a png file
the problam is that my file names are gibberish : enter image description here

This is my code:

output$downloadhist <-
downloadHandler(    
    filename = function() { paste(input$chosenfile,input$chosenSituation, '.png', sep="_")},
    content = function(file) {
        png(file,width     = 700,
  height    = 400,
  units     = "px",)
    print(his())
    dev.off()
  }
  )

Encoding() to the string given to filename gives: UTF-8
I tried to iconv the string to windows-1255 did nothing, tried to iconv to UTF-16 and got an error:Embedded nul in string
How can i make sure that windows can recognize the file name encoding?
my sessioninfo() gives:

R version 3.1.2 (2014-10-31) Platform: x86_64-w64-mingw32/x64 (64-bit)

locale: 1 LC_COLLATE=Hebrew_Israel.1255 LC_CTYPE=Hebrew_Israel.1255 [3] LC_MONETARY=Hebrew_Israel.1255 LC_NUMERIC=C [5] LC_TIME=Hebrew_Israel.1255

attached base packages: 1 stats graphics grDevices utils
datasets methods base

other attached packages: 1 zoo_1.7-12 openxlsx_3.0.0
reshape2_1.4.1 leaflet_1.0.1.9000 [5] ggmap_2.4
plyr_1.8.3 ggplot2_1.0.1 lubridate_1.3.3 [9] htmlwidgets_0.5 scales_0.3.0 shiny_0.12.2

loaded via a namespace (and not attached): 1 colorspace_1.2-6
digest_0.6.8 geosphere_1.3-13 grid_3.1.2 [5] gtable_0.1.2 htmltools_0.2.6 httpuv_1.3.3 jpeg_0.1-8 [9] jsonlite_0.9.17 labeling_0.3 lattice_0.20-29
magrittr_1.5 [13] mapproj_1.2-2 maps_2.3-9
MASS_7.3-35 memoise_0.2.1 [17] mime_0.4
munsell_0.4.2 png_0.1-7 proto_0.3-10 [21] R6_2.1.1 Rcpp_0.12.1 RgoogleMaps_1.2.0.7 rjson_0.2.15 [25] RJSONIO_1.3-0 rstudio_0.98.1102
rstudioapi_0.3.1 sp_1.2-0 [29] stringi_0.5-5
stringr_1.0.0 tools_3.1.2 xtable_1.7-4

 

Joe Cheng

unread,
Feb 2, 2016, 8:25:52 PM2/2/16
to eliav schmulewitz, Shiny - Web Framework for R
Shoot, this is kinda complicated... probably something we'd need to fix in Shiny... http://stackoverflow.com/questions/93551/how-to-encode-the-filename-parameter-of-content-disposition-header-in-http
--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/a8f4caea-efe2-44ca-bec5-c77800859229%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

helg...@gmail.com

unread,
Dec 29, 2017, 9:45:30 PM12/29/17
to Shiny - Web Framework for R
a simple URLencode (from utils) in the filename section will do the trick. 
Reply all
Reply to author
Forward
0 new messages