-
-
Notifications
You must be signed in to change notification settings - Fork 208
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
Add RCPP_USING_UTF8_ERROR_STRING macro to use UTF-8 encoding exception string in R. #493
Add RCPP_USING_UTF8_ERROR_STRING macro to use UTF-8 encoding exception string in R. #493
Conversation
Thanks. The PR is nicely minimal, and even contains ChangeLog and NEWS. Tests would be nice too. As the Contributing.md file suggests, we generally prefer discussion prior to submission but we'll try to review in due course. |
I feel like we shouldn't even use this macro define and always create our strings with UTF-8 encoding. (Ie, we shouldn't use |
Not a bad idea. Any possible side effects? Sounds like I may need a rev.deps run for this. |
I agree with Kevin. I will try to replace BTW, it seems the error fixed by this PR can only be reproduced on Windows. |
Right on. But ... didn't we once try this and failed with a different / older PR? [ Goes off looking ... ] What about #280 by @thirdwing ? |
In the old PR, I try to convert strings into UTF-8 when passing strings from R to C++. Now, this error happens when we throw strings from C++ to R... A good solution is needed for encoding problems... |
FWIW, this PR is a bit more targeted in that we only change the representation of error strings returned to R, not all Rcpp (Ie, this PR doesn't change any of the Rcpp internals; just how R error objects are constructed / thrown) |
Yep, yep. And that we could indeed make unconditionally UTF-8. |
We can remove the macro and make it unconditionally UTF-8, and this may change error messages of some existing packages. Or leave the macro as now, and developers will only be able to change the result with the macro in the new code. |
That is a good point. |
I think I'll merge as-is. We can still discuss
but the current suggestion is good as it is pretty minimal. |
Sounds good to me. |
Hi, I posted on Rcpp mailing list last week about Rcpp exception with UTF-8 strings on Windows.
This PR adds RCPP_USING_UTF8_ERROR_STRING to use UTF-8 encoding exception string in R.
Here is an example for this on Windows.
By default, not using RCPP_USING_UTF8_ERROR_STRING,
Using RCPP_USING_UTF8_ERROR_STRING,