简体   繁体   English

得到??? 在闪亮的 R 中渲染 HTML 时使用符号而不是特殊字符

[英]Getting ??? symbols instead of special characters when rendering HTML in shiny R

When I open my html file in a browser everything renders fine but when I run the shiny app I am getting a ?当我在浏览器中打开我的 html 文件时,一切都很好,但是当我运行闪亮的应用程序时,我得到了一个 ? symbol where certain characters should be.某些字符应该在哪里的符号。 For example the ' symbol returns this in my index page: app?s例如 ' 符号在我的索引页面中返回:app?s

What I want: app's我想要的:应用程序

library(shiny)

ui <- fluidPage(
  uiOutput("html")
)

server <- function(input, output, session) {
  output$html <- renderUI({
    tags$iframe(style = "height:800px; width:100%; scrolling=yes", src = "www/index.html")
  })
}

shinyApp(ui, server)

I figured out my mistake.我发现了我的错误。 The html file had originally been converted from a word document and the encoding was not UTF-8 compatible with R. I simply changed the encoding to UTF-8 and everything works! html 文件最初是从 word 文档转换而来的,编码与 R 不兼容 UTF-8。我只是将编码更改为 UTF-8,一切正常!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM