R-Shiny 应用程序中的重音符号

Crp*_*des 3 r shiny accent-sensitive

我是闪亮的新手,正在尝试输入 html 标签来添加一些标题文本,但包含重音标记的单词(西班牙语中很常见)会导致错误。例如,下面的代码产生了我想要的结果:

\n\n
library(shiny)\nui <- fluidPage(\n\n  titlePanel("Titles"),\n    sidebarLayout(\n      sidebarPanel(  \n        tagList(tags$h4("Geological Survey of Colombia"),\n                tags$h2("Analitic Geochemistry Group"),\n                tags$p("Text here"))),\n\n    # Main panel for displaying outputs ----\n    mainPanel()\n    )\n    )\nserver <- function(input, output) {}\nshinyApp(ui, server)\n
Run Code Online (Sandbox Code Playgroud)\n\n

但更改tags$h4("Geological Survey of Colombia")tags$h4("Servicio Geol\xc3\xb3gico Colombiano")导致错误:

\n\n
 Warning in checkEncoding(file) :   The input file\n C:\\Users\\cparedes\\Documents\\Shiny\\test/app.R does not seem to be\n encoded in UTF8 Warning in readLines(file, warn = FALSE) :   invalid\n input found on input connection\n \'C:\\Users\\cparedes\\Documents\\Shiny\\test/app.R\' Error in parse(file,\n keep.source = FALSE, srcfile = src, encoding = enc) :   \n C:\\Users\\cparedes\\Documents\\Shiny\\test/app.R:7:25: unexpected\n INCOMPLETE_STRING 6:       sidebarPanel(   7:        \n tagList(tags$h4("Servicio Geol\n                            ^ Error in sourceUTF8(fullpath, envir = new.env(parent = globalenv())) :    Error sourcing\n C:\\Users\\cparedes\\AppData\\Local\\Temp\\RtmpOwSrGa\\file132427ca68ec\n
Run Code Online (Sandbox Code Playgroud)\n\n

如何包含重音符号?

\n

use*_*295 5

您可以通过以 UTF-8 格式“使用编码保存”文件来解决此问题。我对重音符号有同样的问题,并使用了本指南https://shiny.rstudio.com/articles/unicode.html