[R] replacing unicode characters

Adrian Dușa du@@@@dr|@n @end|ng |rom gm@||@com
Wed Jun 28 21:09:28 CEST 2023


Dear list,

Building on the example from ?iconv:
x <- "fa\xE7ile"
xx <- iconv(x, "latin1", "UTF-8") # "façile"

and:

iconv(xx, "UTF-8", "ASCII", "Unicode")
# "fa<U+00E7>ile"

This is the type of result I sometimes get from an R script that I cannot
reproduce here, because it depends on a terminal process started in a
compiled Electron (Node.js) application, under MacOS.

I was wondering, is there a standard way, perhaps also using iconv(), to
convert this type of result to a more manageable unicode representation?

Something like: "fa\u00e7ile"

Or perhaps a clever regexp, for any number of such occurrences in a string?

Thanks a lot in advance,
Adrian

	[[alternative HTML version deleted]]



More information about the R-help mailing list