I have a shiny application with data displayed with DT. I can export this data with the buttons extensions. But when I export the data, the accent characters do not show correctly.
How can I change the export encoding to have the accents correctly written ?
The original data is
Nom,"Prenom"
Dupond,"Étienne"
Dupont,"François"
Martin,"Frédéric"
This is what I get when I use the CSV or Excel button :
Nom,"Prenom"
Dupond,"Étienne"
Dupont,"François"
Martin,"Frédéric"
Here is a code sample
library(shiny)
library(DT)
ui <- fluidPage(
DT::DTOutput("table_utilisateurs")
)
server <- function(input, output, session) {
output$table_utilisateurs <- DT::renderDT(server = FALSE, {
DT::datatable(
data.frame(Nom = c('Dupond', 'Dupont', 'Martin'),
Prenom = c('Étienne', 'François', 'Frédéric')),
extensions = "Buttons",
filter = 'top',
rownames = FALSE,
options = list(
pageLength = 10,
lengthMenu = c(10,20,50,100),
order = list(list(0,'asc')),
autoWidth = TRUE,
dom = 'lftipB',
buttons = c('copy', 'csv', 'excel')
)
)
})
}
shinyApp(ui, server)