[freetds] Testing charset

Frediano Ziglio freddyz77 at tin.it
Thu May 8 02:27:50 EDT 2003


Il gio, 2003-05-08 alle 03:41, James K. Lowden ha scritto:
> On 07 May 2003 22:01:41 +0200, Frediano Ziglio <freddyz77 at tin.it> wrote:
> > Received packet @ 2003-05-07 21:58:37.789505
> > 0000 81 01 00 00 00 01 00 ef-02 00 00 d1 02 00 41 00 |........ ......A.|
> > 0010 fd 10 00 c1 00 01 00 00-00                      |........ .|
> > 
> > 
> > 2003-05-07 21:58:37.789540 processing result tokens.  marker is 
> > 81(TDS7_RESULT)2003-05-07 21:58:37.789597 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?
> 
> $ tsql -S UTF8 ...
> locale is "C"
> charset is "646"
> Msg 5703, Level 0, State 1, Server CPRO200, Line 0
> Changed language setting to us_english.
> 1> select nchar(0x41)
> 2> go
> 
> A   
> 1> 
> 
> 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 ...

> Received packet @ 2003-05-07 21:25:16.090320
> 0000 81 01 00 00 00 01 00 ef-02 00 00 d1 02 00 41 00 |........ ......A.|
> 0010 fd 10 00 c1 00 01 00 00-00                      |........ .|
> 
> 
> 2003-05-07 21:25:16.090450 processing result tokens.  marker is 
> 81(TDS7_RESULT)
> 2003-05-07 21:25:16.090543 tds7_get_data_info:1279: 
> 	type = 47 (char)
> 	column_varint_size = 2
> 	colname =  (0 bytes)
> 	column_size = 4 (2 on server)
> 
> Thanks for fixing up tds_iconv_info_init(), btw, Freddy.  
> 

It was on my way :)

freddy77





More information about the FreeTDS mailing list