Skip to content
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

Use Rf_mkCharLenCE() instead of Rf_mkCharLen() #467

Conversation

yutannihilation
Copy link
Contributor

@yutannihilation yutannihilation commented Jan 29, 2023

Just happened to find this. This can be a problem only on Windows with R < 4.2 (Rf_mkCharLen() uses the native encoding), where UTF-8 is not R's default encoding, so this is almost just a nitpicking.

For reference, cpp11 also uses Rf_mkCharLenCE().

https://github.com/r-lib/cpp11/blob/c22dc9b611fe7d56ddfc57add2e01b1424869c0f/inst/include/cpp11/r_string.hpp#L19-L20

@Ilia-Kosenkov
Copy link
Member

Do we need to test this explicitly? Perhaps use a non-ASCII string to see how it is handled?

@yutannihilation
Copy link
Contributor Author

I don't think so. We can test this only on R 4.1, which will retire soon.

@yutannihilation yutannihilation merged commit 974cddc into extendr:master Feb 6, 2023
@yutannihilation yutannihilation deleted the refactor/use-Rf_mkCharLenCE-utf8 branch February 6, 2023 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants