Skip to Content.
Sympa Menu

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

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Marc Abramowitz <marca AT surveymonkey.com>
  • To: "freetds AT lists.ibiblio.org" <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Sending Unicode (UTF-8) data to dbrpcparam - SQL Server receives blank string
  • Date: Wed, 27 Feb 2013 23:00:27 +0000

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?





Archive powered by MHonArc 2.6.24.

Top of Page