-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ref. for codepoints #4
Comments
Base R works with code points, so this works currently: x <- "\U0001f477\u200d\u2642\ufe0f"
# https://apps.timwhitlock.info/unicode/inspect?s=%F0%9F%91%B7%E2%80%8D%E2%99%82%EF%B8%8F
x
#> [1] "👷♂️"
utf8::utf8_print(strsplit(x, "")[[1]], utf8 = FALSE)
#> [1] "\U0001f477" "\u200d" "\u2642" "\ufe0f" Of course it would be more correct to work with graphemes, so if base R will switch to that, then it might not work any more. Btw. cli also has now some handy functions for UTF-8 strings, e.g. it handles graphemes properly: cli::utf8_nchar(x)
#> [1] 1
nchar(x)
#> [1] 4 |
I think It's a good tool for, OK, I've copy-pasted |
Here is a base R solution:
It will mess up the current session of course... |
Right... still useful to mention. For the use case mentioned, we can just open up a new process & run it there quickly. Nice! |
Yeah, maybe there is a way to restore the locale, but
callr can run it in another session:
Maybe it would be enough to change another category. |
Oh, yeah, here it is:
|
Tried looking into this open question in the README:
From this answer here, it looks like "no", unless that logic were to be put into a common package we could reference:
https://stackoverflow.com/a/6240184/3576984
The text was updated successfully, but these errors were encountered: