在R和RStudio查看器上使用DT进行字符编码

在R和RStudio查看器上使用DT进行字符编码,r,encoding,shiny,rstudio,dt,R,Encoding,Shiny,Rstudio,Dt,我在将DT与法语口音(é、è、–…)一起使用时遇到问题: 在RStudio查看器中,这些字符将替换为'�'. 在shiny中,字符显示良好,但如果搜索重音字符,则找不到结果 代码: library(DT) library(shiny) # Viewer dataf <- data.frame(Label = "Activité", Value = 15, stringsAsFactors = F) datatable(dataf) # Shiny server <- f

我在将DT与法语口音(é、è、–…)一起使用时遇到问题:

  • 在RStudio查看器中,这些字符将替换为'�'.
  • 在shiny中,字符显示良好,但如果搜索重音字符,则找不到结果
代码:

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)
欢迎任何帮助, 谢谢


Jérémy

您能试用这些软件包的开发版本吗<代码>开发工具::安装_github(c('rstudio/htmltools','rstudio/DT','rstudio/shinny'))?安装开发版本后:在shinny中没有更改。但是在查看器中有一个bug:只显示colname(粗体,空格分隔),表和值都不显示。不管是否存在特殊字符。设置默认编码是否对您有效:?否,已设置默认编码。
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