簡體   English   中英

R-Shiny app中的重音標記

[英]Accent mark in R-Shiny app

我是新手,我正在嘗試輸入html標簽以添加一些標題文本,但包含重音標記的單詞(在西班牙語中非常常見)會導致錯誤。 例如,下面的代碼產生了我想要的東西:

library(shiny)
ui <- fluidPage(

  titlePanel("Titles"),
    sidebarLayout(
      sidebarPanel(  
        tagList(tags$h4("Geological Survey of Colombia"),
                tags$h2("Analitic Geochemistry Group"),
                tags$p("Text here"))),

    # Main panel for displaying outputs ----
    mainPanel()
    )
    )
server <- function(input, output) {}
shinyApp(ui, server)

但更換tags$h4("Geological Survey of Colombia") tags$h4("Servicio Geológico Colombiano")導致錯誤:

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

如何包含重音符號?

您可以使用UTF-8中的“使用編碼保存”來解決此問題。 我在重音符號上遇到了同樣的問題,並使用了本指南https://shiny.rstudio.com/articles/unicode.html

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM