Skip to content

Instantly share code, notes, and snippets.

@ThierryO
Last active January 19, 2021 08:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ThierryO/0eb85ba25eb52698e6b25e7c40fac557 to your computer and use it in GitHub Desktop.
Save ThierryO/0eb85ba25eb52698e6b25e7c40fac557 to your computer and use it in GitHub Desktop.
test locale
x <- c(
"a", "A", "0", "9", "z", "Z", "\U20AC UTF-8",
"\U00E9", "&", "\U00E0", "\U00B5", "\U00E7", "€ plain", "|", "#", "@", "$"
)
message("raw input")
print(x)
x <- enc2utf8(x)
message("input encoded as UTF-8")
print(x)
Sys.setlocale(locale = "C")
message("sorted input in C locale")
print(sort(x))
message("order in C locale")
print(order(x))
print(sessionInfo())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment