Skip to Content.
Sympa Menu

freetds - Re: [freetds] hard-coded UCS-2 strings and the C standard

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT freetds.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] hard-coded UCS-2 strings and the C standard
  • Date: Mon, 13 Jun 2005 21:45:03 -0400

ZIGLIO, Frediano, VF-IT wrote:
> tds_put_string should work too but it expect client encoding... another
> solution is to separate code to handle iso -> ucs2 conversion. It seems
> that iso2server_metadata conversion is used only to do this conversion,
> perhaps a tds_iso2ucs2le would eliminate the need for this conversion
> too

The advantage of using our iconv system for iso -> ucs2 is that it's
independent of the stack: you can convert any size column data, including
2GB text.

> perhaps a define like
>
> #define TDS_PUT_AS_UCS2(tds, s) do { \
> char buffer[sizeof(s)*2-2]; \
> tds_put_n(tds, buffer, tds_iso2ucs2le(buffer, s)); \
> } while(0)

I think that's not portable. ISTR compilers that don't like arrays based
on sizeof(). Didn't Bill have one?

It looks like your solution and mine are about the same in terms of code
size. I think mine's a little easier to understand. OK to commit?

I'm glad we agree the hard-coded strings are, um, ugly. :-)

Regards,

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page