将unicode hex转换回字符

时间:2018-01-02 21:50:55

标签: r encoding character-encoding

我不确定我的所有编码都是正确的,但是......

假设您有一个字符串,并且您希望将非latin1字符替换为其以字节为单位的表示形式。你这样做:

a <- "It’s weird calling a place home when you moved a lot as a kid"
iconv(tweets$text, from = "UTF-8", to = "latin1", sub = "byte")

得到这个:

[1] It<e2><80><99>s weird calling a place home when you moved a lot as a kid

现在我想从其编码版本转换该字符串 back ,并且本质上返回您原来的相同字符串。你是怎么做到的?

0 个答案:

没有答案