powered by
Convert character vector to ASCII, replacing non-ASCII characters with single-byte (\x00) or two-byte (\u0000) codes.
ASCIIfy(x, bytes = 2, fallback = "?")
A character vector like x, except non-ASCII characters have been replaced with \x00 or \u0000 codes.
x
a character vector, possibly containing non-ASCII characters.
either 1 or 2, for single-byte (\x00) or two-byte (\u0000) codes.
1
2
an output character to use, when input characters cannot be converted.
Arni Magnusson.
showNonASCII identifies non-ASCII characters in a character vector.
showNonASCII
cities <- c("S\u00e3o Paulo", "Reykjav\u00edk") print(cities) ASCIIfy(cities, 1) ASCIIfy(cities, 2) athens <- "\u0391\u03b8\u03ae\u03bd\u03b1" print(athens) ASCIIfy(athens)
Run the code above in your browser using DataLab