[freetds] Testing charset

Frediano Ziglio freddyz77 at tin.it
Thu May 8 10:54:03 EDT 2003


> > 
> > 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?  
> 

Fully agree. However current implementation never use
TDSLOGININFO->client_charset. There are two method to build
TDSCONNECTINFO:
1:
a- allocate connect
b- fill values (sometime reading freetds.conf with its client charset)
c- call tds_fix_connect
(used in odbc, do not involve TDSLOGININFO so no problem)
2:
a- allocate connect (we pass locale to overwrite server charset, and we
initialize client_charset)
b- get values from freetds.conf
c- replacing with TDSLOGININFO info
d- call tds_fix_connect

However 2c found always a value (or from default or from freetds.conf)
so it never replace it!!!

Perhaps we should initialize TDSCONNECTINFO->client_charset to empty and
set it to default on tds_fix_connect ?? This should fix the problem...

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

I imagined. My test system was RH8 with use UTF8 by default (so tsql set
TDSLOGIN to UTF-8).

> 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().   
> 

AM_ICONV is now defined in gettext (same implementation)... 

IMHO some simple rows can fix the problem

if test "$am_cv_func_iconv" = yes; then
	OLDLIBS="$LIBS"
	LIBS="$LIBS $LIBICONV"
	AC_CHECK_FUNCS(locale_charset)
	LIBS="$OLDLIBS"
fi

bye
  freddy77





More information about the FreeTDS mailing list