简体   繁体   English

R-Shiny app中的重音标记

[英]Accent mark in R-Shiny app

I am new to shiny and am trying to input html tags for adding some header text but the words that contain an accent mark (as very usual in spanish) results in error. 我是新手,我正在尝试输入html标签以添加一些标题文本,但包含重音标记的单词(在西班牙语中非常常见)会导致错误。 For example, the code below produces what I want: 例如,下面的代码产生了我想要的东西:

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)

But changing tags$h4("Geological Survey of Colombia") for tags$h4("Servicio Geológico Colombiano") results in the error: 但更换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

How can Include the accent marks? 如何包含重音符号?

You can solve this with "Save with encoding" your file in UTF-8. 您可以使用UTF-8中的“使用编码保存”来解决此问题。 I had the same issue with accent marks and used this guide https://shiny.rstudio.com/articles/unicode.html 我在重音符号上遇到了同样的问题,并使用了本指南https://shiny.rstudio.com/articles/unicode.html

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

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