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: "James K. Lowden" <jklowden AT schemamania.org>
  • To: freetds AT lists.ibiblio.org
  • Subject: Re: [freetds] RE: Charset conversion with Sybase ASE 12.0
  • Date: Wed, 27 Nov 2002 00:51:15 -0500

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

Attachment: tsql.diff
Description: Binary data




Archive powered by MHonArc 2.6.24.

Top of Page