Using “cat” to write non-English characters into a .html file (in R)

前端 未结 3 1935
野的像风
野的像风 2021-01-21 08:33

Here is the code showing the problem:

myPath = getwd()
cat(\"abcd\", append = T, file =paste(myPath,\"temp1.html\", sep = \"\\\\\")) # This is fine
cat(\"
3条回答
  •  深忆病人
    2021-01-21 09:05

    Your code is a bit redundant. Is temp1.txt on line 5 a typo (.html)? Anyway, perhaps you should set charset within tag.

    Take this as an example:

    
    
    
    
    
    <%
    cat("abcd")
    cat("


    ") cat("שלום") cat("שלום") (x <- iconv("שלום", from = "CP1252", to = "UTF8") ) cat(x) -%>

    It is a brew code, so if you go ahead and brew it, you'll get correct response. Long story short, the keyword was charset.

提交回复
热议问题