Subject: | unicode table data is returned by SAP::Rfc with is_utf8 flag off |
Hello,
I send unicode table to RFC procedure and get another unicode table in
reply (both are RFCTYPE_CHAR). Rows in reply table are mangled (I
suspect they get promoted to "iso8859-1" by default, instead of "utf8").
IMO this is completely wrong for unicode RFCTYPE_CHAR data, because it's
text, unicode text and it explicitly gets converted from "UTF-16LE" to
"UTF-8" (alloc_iconv("UTF-16LE", "UTF-8")). Hence the result is utf8
string and should have appropriate flag set.
Patch is attached.
--
WBR,
xrgtn
Subject: | u16to8_SvUTF8_on.patch |
--- Rfc.xs.orig 2011-10-19 15:24:18.000000000 +0300
+++ Rfc.xs 2011-10-19 15:28:03.000000000 +0300
@@ -748,6 +748,9 @@ SV* u16to8(char * string, int ilen) {
my_iconv_t myiconvt = alloc_iconv("UTF-16LE", "UTF-8");
perl_str = u_doconv16to8str(myiconvt->iconv_handle, string, ilen, myiconvt->is_target_utf8);
dealloc_iconv(myiconvt);
+#ifdef SvUTF8_on
+ SvUTF8_on(perl_str);
+#endif
return perl_str;
}