Converting a \u escaped Unicode string to ASCII

后端 未结 7 903
感动是毒
感动是毒 2020-11-30 09:05

After reading all about iconv and Encoding, I am still confused.

I am scraping the source of a web page I have a string that looks like thi

7条回答
  •  天命终不由人
    2020-11-30 09:41

    A use for eval(parse)!

    eval(parse(text=paste0("'", x, "'")))
    

    This has its own problems of course, such as having to manually escape any quote marks within the string. But it should work for any valid Unicode sequences that may appear.

提交回复
热议问题