Coverting unicode codeepoint format

2019-08-16 15:00发布

问题:

Let's say that I have a character string containing bytes representing an emoji:

string <- "This is a test. U+1F600"

How can I transform it into

string <- "This is a test. \U0001F600"

So that I can render it as

utf8_print("This is a test \U0001F600")
[1] "This is a test