Re: [Rcpp-devel] String encoding (UTF-8 conversion)

2014-12-15 Thread Romain Francois
That is similar to a path i've followed in Rcpp11/Rcpp14.

What's really missing in R is api access to strings, e.g testing for equality 
of two CHARSXP, comparing them, ...

This causes all sorts of problems with dplyr. 

Romain

> Le 16 déc. 2014 à 06:00, Jeroen Ooms  a écrit :
> 
>> On Thu, Dec 11, 2014 at 12:24 PM, Jeroen Ooms  
>> wrote:
>> I'm interfacing a c++ library which assumes strings are UTF-8. However
>> strings from R can have various encodings. It's not clear to me how I
>> need to account for that in Rcpp.
> 
> Follow-up on this: from what I have found, there is currently no
> string type that is unambiguous across platforms and locales (other
> than the actual STRSXP). If the native locale uses UTF8 than all is
> fine, but we can not assume that in R. Here is a little script that
> illustrates the various combinations I tried and the results on
> Windows: https://gist.github.com/jeroenooms/9edf97f873f17a4ce5d3.
> 
> Assuming that each of these cases are intended behavior, perhaps we
> could introduce an additional string type e.g. Rcpp::UTF8String. The
> mapping from STRSXP to Rcpp::UTF8String would use
> translateCharUTF8(STRING_ELT(x, 0)) and the mapping Rcpp::UTF8String
> back to STRSXP would use SET_STRING_ELT(out, 0, mkCharCE(olds,
> CE_UTF8)). That would allow for defining c++ functions operating on
> UTF8 strings which will work as expected across platforms and locales.
> ___
> Rcpp-devel mailing list
> Rcpp-devel@lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
___
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Re: [Rcpp-devel] String encoding (UTF-8 conversion)

2014-12-15 Thread Jeroen Ooms
On Thu, Dec 11, 2014 at 12:24 PM, Jeroen Ooms  wrote:
> I'm interfacing a c++ library which assumes strings are UTF-8. However
> strings from R can have various encodings. It's not clear to me how I
> need to account for that in Rcpp.

Follow-up on this: from what I have found, there is currently no
string type that is unambiguous across platforms and locales (other
than the actual STRSXP). If the native locale uses UTF8 than all is
fine, but we can not assume that in R. Here is a little script that
illustrates the various combinations I tried and the results on
Windows: https://gist.github.com/jeroenooms/9edf97f873f17a4ce5d3.

Assuming that each of these cases are intended behavior, perhaps we
could introduce an additional string type e.g. Rcpp::UTF8String. The
mapping from STRSXP to Rcpp::UTF8String would use
translateCharUTF8(STRING_ELT(x, 0)) and the mapping Rcpp::UTF8String
back to STRSXP would use SET_STRING_ELT(out, 0, mkCharCE(olds,
CE_UTF8)). That would allow for defining c++ functions operating on
UTF8 strings which will work as expected across platforms and locales.
___
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel


[Rcpp-devel] Solaris anyone?

2014-12-15 Thread Dirk Eddelbuettel

I have an open bug reports against RcppCNPy concerning behaviour on Solaris.
But I can't make any progress on this as I do not have access to Solaris.

Would anybody does anybody here have access? It is really just a matter of
reading / writing a few short test files in both Python and R -- which I
could prepare.

Thanks,  Dirk

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org
___
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel


Re: [Rcpp-devel] Status of ARMA_64BIT_WORD in RcppArmadillo

2014-12-15 Thread Dirk Eddelbuettel

On 15 December 2014 at 05:28, Balamuta, James Joseph wrote:
| Thanks!
| 
| One last question, this is the proper way to set the flags in src/Makevars?
| 
| PKG_CXXFLAGS=-I../inst/include -DARMA_64BIT_WORD
| PKG_LIBS= $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
| CXX_STD = CXX11

That looks good to me.  PKG_CXXFLAGS and PKG_CPPFLAGS are both fine candidates.

Dirk

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org
___
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel