闪亮的本地部署错误:输入字符串1无效的UTF-8 [英] Shiny local deployment error : input string 1 is invalid UTF-8

查看:572
本文介绍了闪亮的本地部署错误:输入字符串1无效的UTF-8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很惊讶地看到一个突然的错误,我的ShinyApp停止工作,并出现一个未知错误,提示输入字符串1为无效UTF-8".即使在昨天,该应用程序仍然运行正常,但是突然停止了运行.

I am surprised to see a sudden error where my ShinyApp stopped working with an unknown error saying 'input string 1 is invalid UTF-8'. Even on yesterday, that App was working perfectly, however, stopped all sudden.

下面是我运行runApp()

> runApp()

Listening on http://127.0.0.1:3726
Warning: Error in sub: input string 1 is invalid UTF-8
Stack trace (innermost first):
    1: runApp
Error : input string 1 is invalid UTF-8

我的会话信息:

> library(shiny); sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.6

Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib

locale:
[1] C/UTF-8/C/C/C/C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] shiny_1.0.5

loaded via a namespace (and not attached):
[1] compiler_3.4.1  R6_2.2.2        htmltools_0.3.6 Rcpp_0.12.12   
[5] digest_0.6.12   xtable_1.8-2    httpuv_1.3.5    mime_0.5 

有人遇到过类似的错误吗?感谢有关如何解决此错误的任何指针.我在网上搜索了一段时间以寻求解决方案,但是没有找到任何相关的解决方案.

Have someone faced with similar error? Appreciate for any pointer on how to fix this error. I searched over net for a while for its solution, however didnt find any relevant.

感谢您的时间.

谢谢

推荐答案

您是否有机会使用includeHTML?

将Microsoft Publisher文档另存为.htm文件,然后将它们拍打到应用程序中时遇到了这个问题.

I've had this issue when saving Microsoft Publisher documents as .htm files then slapping them into an app.

includeHTML似乎强制使用"UTF-8"编码:

It looks like includeHTML enforces 'UTF-8' encoding:

> includeHTML
function (path) {
  lines <- readLines(path, warn = FALSE, encoding = "UTF-8")
  return(HTML(paste8(lines, collapse = "\\r\\n")))
}

但是我的Windows 10系统默认值为'ISO-8859-1'.

However my Windows 10 system default is 'ISO-8859-1'.

在Rstudio中,您可以执行文件>使用编码保存> UTF-8 ,一切似乎都可以正常进行.否则,您可以覆盖includeHTML函数以允许设置readLines的编码参数.

In Rstudio you can do File > Save With Encoding > UTF-8 and everything seems to work. Otherwise you could override the includeHTML function to allow the encoding argument of readLines to be set.

这篇关于闪亮的本地部署错误:输入字符串1无效的UTF-8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆