Skip to Content.
Sympa Menu

freetds - RE: [freetds] RE: Charset conversion with Sybase ASE 12.0

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Maxim V Rayevskiy" <ra-max AT yandex.ru>
  • To: <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] RE: Charset conversion with Sybase ASE 12.0
  • Date: Tue, 3 Dec 2002 13:40:47 +0300

I have downloaded the snapshot as of December, 3 and tried to compile
it. When it got to TSQL, the compilation stopped and I got an error:

source='tsql.c' object='tsql.o' libtool=no depfile='.deps/tsql.Po'
tmpdepfile='.deps/tsql.TPo' depmode=gcc /bin/sh ../../depcomp gcc
-DHAVE_CONFIG_H -I. -I. -I../../include -I../../include
-D_FREETDS_LIBRARY_SOURCE -DTDS50 -Wall -Wstrict-prototypes
-Wmissing-prototypes -g -O2 -c `test -f 'tsql.c' || echo './'`tsql.c
tsql.c:56: langinfo.h: No such file or directory
*** Error code 1

Stop in /usr/home/ramax/freetds-0.60/src/apps.
*** Error code 1

Stop in /usr/home/ramax/freetds-0.60/src.
*** Error code 1

Stop in /usr/home/ramax/freetds-0.60.

I am not qualified to say whether the source is broken or I'm missing
some step. Any additional information you may need - I will try to
provide.

So, I was unable to try out the solution.

Regarding charset selection from tsql: I am quite used to the way Sybase
isql handles the matter. It always uses the default character set and
language as set up in locales.dat. Therefore, it disregards any Windows'
regional settings. I would suggest the same approach for tsql: always
use whatever in freetds.conf or locales.conf in that order (as described
in James' first reply).

Best regards,
Maxim



-----Original Message-----
From: freetds-admin AT lists.ibiblio.org
[mailto:freetds-admin AT lists.ibiblio.org] On Behalf Of James K. Lowden
Sent: Wednesday, November 27, 2002 8:51 AM
To: freetds AT lists.ibiblio.org
Subject: Re: [freetds] RE: Charset conversion with Sybase ASE 12.0


On Tue, 26 Nov 2002 17:20:15 -0500, "Lowden, James K"
<LowdenJK AT bernstein.com> wrote:
> > From: Maxim V Rayevskiy [mailto:ra-max AT yandex.ru]
> > Sent: November 25, 2002 12:09 PM
> >
> > I have set the locale for my login according to
> > the FreeBSD
> > handbook as you suggested. So, the environment variables are now as
> > follows:
> >
> > LANG=ru_RU.KOI8-R
> > MM_CHARSET=KOI8-R
>
> I see in the source that tsql hard-codes the client charset to
> "iso_1".
> I don't know how to fetch the client charset (apart from parsing the
> environment strings, which can't be right). I'll look into it.

I have committed a rough fix to tsql. It will be available in the
nightly snapshot, or you should be able to apply the attached patch.
tsql will print out the locale information it finds in your environment
and use that (for now). With luck, it will show "KOI8-R". I don't have
FreeBSD (I have NetBSD, and we're behind you), so I can't test my fix.

This is not a complete fix. It actually highlights a couple of issues.


Sybase connections do not involve libiconv. Any server<->client charset
conversion is handled by the server; the client need only communicate
its desired charset to the server at login.

With this patch, tsql acquires its client charset from the environment
via libc. IMO, tsql should not be involved in the equation, because
tds_read_config_info() should provide the functionality. The charset
should be determined by:

1. Compiled-in setting (iso_1)
2. nl_language(3)
3. freetds.conf

in that order. I think at the current time we do not use charset
information except for libiconv (TDS 7+), but I'm too tired now to find
the guilty code.

Comments?

--jkl





  • RE: [freetds] RE: Charset conversion with Sybase ASE 12.0, Maxim V Rayevskiy, 12/03/2002

Archive powered by MHonArc 2.6.24.

Top of Page