Re: Sending Unicode (UTF-8) data to dbrpcparam - SQL Server receives blank string

Marc Abramowitz <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <E5CD626161E81C4DBB58B3E7F649BEA2138673@DAGN04b-e6.exg6.exghost.com>
A little more info…

If I add the following:

diff --git a/src/tds/query.c b/src/tds/query.c
index 168c4d5..17f227c 100644
--- a/src/tds/query.c
+++ b/src/tds/query.c
@@ -1621,7 +1621,10 @@ tds_put_data(TDSSOCKET * tds, TDSCOLUMN * curcol)
                /* we need to convert data before */
                /* TODO this can be a waste of memory... */
                converted = 1;
+               tdsdump_log(TDS_DBG_INFO1, "tds_put_data: calling tds_convert_string on \"%s\"; colsize = %d; client_charset = \"%s\"; server_charset = \"%s\"\n",
+                           s, colsize, curcol->char_conv->client_charset.name, curcol->char_conv->server_charset.name);
                s = tds_convert_string(tds, curcol->char_conv, s, colsize, &output_size);
+               tdsdump_log(TDS_DBG_INFO1, "tds_put_data: result of tds_convert_string => \"%s\"\n", s);
                colsize = (TDS_INT)output_size;
                if (!s) {
                        /* on conversion error put a empty string */

Here's what I get:

query.c:1624:tds_put_data: calling tds_convert_string on "Здравствуй^A"; colsize = 20; client_charset = "UTF-8"; server_charset = "CP1252"
util.c:331:tdserror(0x101506eb0, 0x10159fdb0, 2402, 0)
dblib.c:7929:dbperror(0x10159fac0, 2402, 0)
dblib.c:7981:2402: "Error converting characters into server's character set. Some character(s) could not be converted"
dblib.c:8002:"Error converting characters into server's character set. Some character(s) could not be converted", client returns 2 (INT_CANCEL)
util.c:361:tdserror: client library returned TDS_INT_CANCEL(2)
util.c:384:tdserror: returning TDS_INT_CANCEL(2)
query.c:1627:tds_put_data: result of tds_convert_string => "(null)"

Should I be suspicious of the "^A" (null byte?) tacked on to the end of my string? Maybe that 's why the conversion is failing?

_______________________________________________
FreeTDS mailing list
[email protected]
http://lists.ibiblio.org/mailman/listinfo/freetds
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.