Skip to Content.
Sympa Menu

freetds - RE: [freetds] iconv problem

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Lowden, James K" <LowdenJK AT bernstein.com>
  • To: 'FreeTDS Development Group' <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] iconv problem
  • Date: Wed, 23 Jul 2003 11:11:20 -0400

> From: ZIGLIO Frediano [mailto:Frediano.Ziglio AT vodafone.com]
> Sent: July 23, 2003 9:33 AM
>
> SQL error S1000 -- [unixODBC]iconv E2BIG: Error converting between
> character sets. Output buffer exhausted.
...
> >From write.c
>
> if (IS_TDS7_PLUS(tds)) {
> while (len > 0) {
> tdsdump_log(TDS_DBG_NETWORK, "%L
> tds_put_string
> converting %d bytes of \"%s\"\n", len, s);
> outbytesleft = sizeof(outbuf);
> poutbuf = outbuf;
^^^^^^^^^^^^^^^^ noted, thanks.
> if (-1 == tds_iconv(tds, tds->iconv_info,
> to_server, &s, &len, &poutbuf, &outbytesleft))
> break;
> bytes_out = poutbuf - outbuf;
> tds_put_n(tds, outbuf, bytes_out);
> }
> tdsdump_log(TDS_DBG_NETWORK, "%L
> tds_put_string wrote %d
> bytes\n", bytes_out);
> return bytes_out;
> }
>
> tds_put_string should manage string in chunk but it return after first
> tds_iconv (cause it return -1) and return 0 as bytes_out... On E2BIG
> error tds_iconv add a message to client but doing chunk
> conversion this is not the right behavior...

I'll fix this. Error is calling tds_iconv with unaltered "len"; the passed
parameter should be:

sizeof(outbuf) * client->min_bytes_per_char
/
server->max_bytes_per_char;

> Also in tds_put_string poutput buffer
> should be initialized for every loop

Right.

> bytes_out should contain all bytes written, not only last write count.

Probably, but the return code is usually ignored.

--jkl
-----------------------------------------
The information contained in this transmission may contain privileged and
confidential information and is intended only for the use of the person(s)
named above. If you are not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient, any
review, dissemination, distribution or duplication of this communication is
strictly prohibited. If you are not the intended recipient, please contact
the sender immediately by reply e-mail and destroy all copies of the original
message. Please note that we do not accept account orders and/or instructions
by e-mail, and therefore will not be responsible for carrying out such orders
and/or instructions.






Archive powered by MHonArc 2.6.24.

Top of Page