[freetds] Testing charset

Lowden, James K LowdenJK at bernstein.com
Thu May 8 10:19:08 EDT 2003

> From: Frediano Ziglio [mailto:freddyz77 at tin.it]
> Sent: May 8, 2003 2:29 AM
> Il gio, 2003-05-08 alle 03:41, James K. Lowden ha scritto:
> > On 07 May 2003 22:01:41 +0200, Frediano Ziglio wrote:
> tds7_get_data_info:1279: 
> > >         type = 47 (char)
> > >         column_varint_size = 2
> > >         colname =  (0 bytes)
> > >         column_size = 1 (2 on server)
> > >          ^^^^^^^^^^^^^^^ this sounds strange... it should be 3
> > 
> > That's not what I get.  Did you fix it already?
> > Starting log file for FreeTDS 0.62.dev.20030507 with debug level 99.
> > iconv to convert client-side data to the "UTF-8" character set
> > 2003-05-07 21:24:11.122396 tds_iconv_info_init: converting
> > "UTF-8"->"UCS-2LE"
> > 2003-05-07 21:24:11.122698 tds_iconv_info_init: converting
> > "ANSI_X3.4-1968"->"UCS-2LE"
> > ...
> Problem seem config.c...
> in tds_config_login:
> 	/* don't overwrite freetds.conf client charset with one 
> derived from
> the environment. */
> 	if (tds_dstr_isempty(&connect_info->client_charset) &&
> !tds_dstr_isempty(&login->client_charset)) {
> 		tds_dstr_copy(&connect_info->client_charset,
> tds_dstr_cstr(&login->client_charset));
> 		tdsdump_log(TDS_DBG_INFO1, "%L 
> tds_config_login:%d: %s is %s.\n",
> __LINE__, "client_charset",
> 			    connect_info->client_charset);
> 	}
> However connect_info->client_charset is set by default, so charset is
> not overwritten ...
> I don't understand why your version use UTF-8 and why my 
> version (well,
> CVS one) do not read character converting it to ISO-8859-1 ...

The "don't overwrite freetds.conf client charset" comment is mine.  I'm
relying on the "client charset" entry in freetds.conf, not
nl_langinfo(CODESET).  Absolutely I think freetds.conf should supersede any
environmental localization; that lets misconfigured or misunderstood clients
function.  That includes applications that, for whatever reason, fail to
call setlocale(3).  Do you agree?  

For testing, I connect to the same server using different sections in
freetds.conf.  Each server has its own "client charset" entry.  

I would like to start using locale_charset(3) to get the client charset
name, but I'm have a hard time pursuading autoconf that I have it installed.
I'm pretty sure I have to modify aclocal.m4, where we locate libiconv.  That
code came from Bruno Haible; maybe I should ask him if he's extended it or
has something else for locale_charset().   


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.

More information about the FreeTDS mailing list