2

I have a problem using DT with french accents (é, è, â...) :

  • In the RStudio Viewer, those characters are replaced by '�'.
  • In shiny, characters are well displayed, but if I search an accented character no results are found.

Code :

library(DT)
library(shiny)

# Viewer

dataf <- data.frame(Label =  "Activité", Value = 15, stringsAsFactors = F)
datatable(dataf)

# Shiny

server <- function(input, output) {
  output$dtf <- renderDataTable({
    data.frame(Label =  "Activité", Value = 15, stringsAsFactors = F)
    })
}

ui <- fluidPage(
  dataTableOutput('dtf')
)

shinyApp(ui = ui, server = server)

I tried :

  • set encoding of dataf to UTF-8 and latin1
  • change the escape parameter of datatbale to TRUE
  • Set default text encoding of RStudio to UTF-8
  • Change browser : Firefox 41 & Chrome 45

but nothing solved the problem

My sessionInfo (I use RStudio 0.99.484) :

R version 3.2.1 (2015-06-18)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows 7 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=French_France.1252  LC_CTYPE=French_France.1252   
[3] LC_MONETARY=French_France.1252 LC_NUMERIC=C                  
[5] LC_TIME=French_France.1252    

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

other attached packages:
[1] shiny_0.12.2 DT_0.1      

loaded via a namespace (and not attached):
 [1] htmlwidgets_0.5  R6_2.1.1         magrittr_1.5     htmltools_0.2.6  tools_3.2.1     
 [6] rstudioapi_0.3.1 yaml_2.1.13      Rcpp_0.12.1      jsonlite_0.9.17  digest_0.6.8    
[11] xtable_1.7-4     httpuv_1.3.3     mime_0.4     

Any help is welcomed, thanks,

Jérémy

jlesuffleur
  • 1,113
  • 1
  • 7
  • 19
  • Could you try the development version of these packages? `devtools::install_github(c('rstudio/htmltools', 'rstudio/DT', 'rstudio/shiny'))`? – Yihui Xie Oct 26 '15 at 22:52
  • After installing the dev versions : In shiny there is no change. But in the Viewer there is a bug : only colnames are displayed (in bold, spaces separated), neither table nor values are. Regardless of the presence of special characters. – jlesuffleur Oct 27 '15 at 09:12
  • Does setting the default encoding work for you: http://stackoverflow.com/a/23527591/946850? – krlmlr Mar 14 '16 at 14:28
  • No, default encoding is already set. – jlesuffleur Mar 16 '16 at 09:29

0 Answers0