pe-perry
pe-perry

Reputation: 2621

Display unicode in R

I have some unicode character that is stored as "<U+9577><U+6D32>". Is it possible to convert it into "\u9577\u6D32"?

Thanks!

Upvotes: 1

Views: 1805

Answers (1)

lukeA
lukeA

Reputation: 54237

You could use

as.character(parse(text=shQuote(gsub("<U\\+([A-Z0-9]+)>", "\\\\u\\1", "<U+9577><U+6D32>"))))

(via)

Upvotes: 4

Related Questions