[freetds] Charset question

jack brack jack.brack at inbox.com
Tue Apr 18 06:46:46 EDT 2006


> Jack, you found that unsetting LC_LANG caused an ASCII login.  That leads
> to two possibilities.  One, you could set your client for ISO 8859-1,
> which is what Sybase calls iso_1.  I think that will fix your login
> problem.
> 
> The solution should be to do this in freetds.conf:
> 
> 	[global] # or servername
> 		tds version = 5.0
> 		client charset = ISO-8859-1

Yes I tried this, but it didn't work. The LANG setting is overriding it.
Setting LANG to ISO-8859-1, C, iso8859-1, even iso_1 doesn't work either.
(I thought the client charset in this file was ignored and I was meant to use locales.conf?)

> That should work, but ISTR you tried that and it didn't.  Here's the
> relevant code from login.c:
> 
>         /* use charset nearest to client or nothing */
>         server_charset = NULL;
>         if (!tds_dstr_isempty(&connection->server_charset))
>                 server_charset =
> tds_dstr_cstr(&connection->server_charset);
>         else
>                 server_charset =
> tds_sybase_charset_name(tds_dstr_cstr(&connection->client_charset));
>         if (!server_charset)
>                 server_charset = "";
>         tds_put_login_string(tds, server_charset, TDS_MAX_LOGIN_STR_SZ);
>      /* charset */
> 
> So, clearly, if that freetds.conf entry doesn't override the environment,
> then connection->server_charset is not null.  It will take a little work
> to find out why.  But I think we're at least in the neighborhood.
> 
> Regards,
> 
> --jkl

Here are the relevant files, in case it helps:

test-script.php:
<?
$server = "SERVERNAME_ctmod";
$user = "sa";
$passs = "hidden";
sybase_connect($server, $user, pass);
?>

/etc/freetds/freetds.conf:
[SERVERNAME_ctmod]
        host = staging.private.dmz
        port = 5001
        tds version = 5.0
        client charset = ISO-8859-1
        dump file = /tmp/freetds.log
        debug level = 10

/etc/freetds/locales.conf currently does not exist.

I really appreciate the work being put into this. Hopefully I can get something that works soon.

JB


More information about the FreeTDS mailing list