Revision: 357 http://rpy.svn.sourceforge.net/rpy/?rev=357&view=rev Author: warnes Date: 2007-10-17 18:26:34 -0700 (Wed, 17 Oct 2007)
Log Message: ----------- Handle python unicode strings in calls to R by first converting to python ascii strings Modified Paths: -------------- trunk/rpy/src/rpymodule.c Modified: trunk/rpy/src/rpymodule.c =================================================================== --- trunk/rpy/src/rpymodule.c 2007-10-08 20:35:27 UTC (rev 356) +++ trunk/rpy/src/rpymodule.c 2007-10-18 01:26:34 UTC (rev 357) @@ -420,6 +420,22 @@ COMPLEX_DATA(robj)[0].r = c.real; COMPLEX_DATA(robj)[0].i = c.imag; } + else if (PyUnicode_Check(obj)) + { + /** Handle Unicode Strings. + * + * Ideally: Python Unicode -> R Unicode, + * + * Unfortunately, the R documentation is not forthcoming on how + * to accomplish this + * + * So, for the moment: + * python Unicode -> Python ASCII -> ordinary string -> R string + * + */ + PROTECT(robj = NEW_STRING(1)); + SET_STRING_ELT(robj, 0, COPY_TO_USER_STRING(PyString_AsString(PyUnicode_AsASCIIString(obj)))); + } else if (PyString_Check(obj)) { PROTECT(robj = NEW_STRING(1)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ rpy-list mailing list rpy-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rpy-list