On Thu, Dec 11, 2014 at 2:16 PM, Dirk Eddelbuettel <e...@debian.org> wrote: > Maybe the same way? ;-)
OK I am not completely back at the C api, and it still doesn't work when called via Rcpp: // [[Rcpp::export]] SEXP echo(SEXP src){ const char* utf8str = Rf_translateCharUTF8(Rf_asChar(src)); SEXP out = PROTECT(Rf_allocVector(STRSXP, 1)); SET_STRING_ELT(out, 0, Rf_mkCharCE(utf8str, CE_UTF8)); UNPROTECT(1); return out; } > test [1] "東京" > echo(test) [1] "æ ±äº¬" > echo(enc2utf8 (test)) [1] "æ ±äº¬" Also: > echo("Zürich") [1] "Zürich" > echo(enc2utf8("Zürich")) [1] "Zürich" The same function works perfectly fine when invoked via .Call(). Does Rcpp somehow override the CE or attempt to recode strings before giving them back to R? _______________________________________________ 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