Convert unicode to readable characters in R

前端 未结 1 762
灰色年华
灰色年华 2020-12-10 20:10

I have a .csv where the encoding returns \"unknown\" and \"UTF-8\" when using Encoding(data). The text looks like this:

1条回答
  •  孤城傲影
    2020-12-10 20:14

    You could do something like this:

    library(stringi)
    
    string <- " \n\n " 
    
    cat(stri_unescape_unicode(gsub("", "\\\\u\\1", string)))
    

    Which results in:

    ၂၀၂၀ မွာ

    တိုင္းျပည္ကိုလဲ ကာကြ

    0 讨论(0)
提交回复
热议问题