Skip to Content.
Sympa Menu

freetds - Re: [freetds] How to set tsql's client character set

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Lowden, James K" <james.k.lowden AT alliancebernstein.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] How to set tsql's client character set
  • Date: Fri, 11 Aug 2006 13:13:47 -0400

> From: KJ
> Sent: Friday, August 11, 2006 10:12 AM
>
> > Nice work!
> >
> > The goal is to make it unnecessary to declare the client charset
> > in freetds.conf for a correctly configured machine. That is, we
> > want to rely on the locale settings unless overridden by
> > freetds.conf.
> >
> > Steve Langasek submitted a patch for 0.64 to do that but it was
> > late in the release cycle. I eventually decided to defer it
> > because there are a lot of permuations and I wanted to look at
> > it more closely. :-(
>
> I just went through the ML and found that stuff quiet confusing.
> I don't understand what's the difference between server/wire
> character set and client character set. Sybase tools (isql, bcp)
> offer an additional option -J for specifying the client's character
> set. If that option is missing the platform's default is being
> used, if followed by a charset then that one is used, if -J is
> specified without parameter, then the server's characater set is
> used, whatever it might be (in the latter case no charset is being
> sent in the login record). Hence the client does not have to know
> server's charset. The character set conversion is done on the
> server. If both character sets are equal no conversion is done
> otherwise the conversion rules applies (with or without conversion
> errors).
>
> My suggestion is to use the approach above, without usage of any
> *.conf file (concerning char sets!).

KJ,

http://manuals.sybase.com/onlinebooks/group-cnarc/cng1110e/dblib/@ebt-li
nk;pt=9760?target=%25N%15_37138_START_RESTART_N%25

While I agree that implementing Sybase's charset control options would
be useful (particularly for bcp), I also think it's a distraction.
Fundamentally, we have to pass the correct client charset in the TDS 5.0
login record. We're really just talking about how the default is
determined. We want to use the following order:

1. programmatic setting (-J, DBSETLCHARSET)
2. freetds.conf
3. locale

IOW, if the application sets the charset, we ignore freetds.conf, else
we look in freetds.conf. If it's not set there, we rely on the locale.
That way, for a correctly configured machine -- i.e. one that can
display characters in the charset indicated by the locale -- everything
Just Works. For some applications, say a server that itself is ISO
8859-1 but generates HTML documents in UTF-8, the freetds.conf override
is handy.

I don't want to waste your time. I suggest you either apply Steve's
patch to try to roll your own, such that the locale doesn't override
your freetds.conf setting. Then I think you'll be home free.

Regards,

--jkl

-----------------------------------------
The information contained in this transmission may be privileged and
confidential and is intended only for the use of the person(s) named
above. If you are not the intended recipient, or an employee or agent
responsible
for delivering this message to the intended recipient, any review,
dissemination,
distribution or duplication of this communication is strictly prohibited. If
you are
not the intended recipient, please contact the sender immediately by reply
e-mail
and destroy all copies of the original message. Please note that we do not
accept
account orders and/or instructions by e-mail, and therefore will not be
responsible
for carrying out such orders and/or instructions. If you, as the intended
recipient
of this message, the purpose of which is to inform and update our clients,
prospects
and consultants of developments relating to our services and products, would
not
like to receive further e-mail correspondence from the sender, please "reply"
to the
sender indicating your wishes. In the U.S.: 1345 Avenue of the Americas, New
York,
NY 10105.




Archive powered by MHonArc 2.6.24.

Top of Page