[freetds] Character set problem
Lowden, James K
LowdenJK at bernstein.com
Thu Sep 16 12:34:30 EDT 2004
From: Hannu Niemi
Sent: Thursday, September 16, 2004 1:39 AM
If I set the client charcter set cp1252, the characters get encoded,
but wrongly. Of course I could translate these characters to the
right ones, but it looks unproductive ;)
-----End Original Message-----
Thanks for the problem report, and I hope Frediano's spectacular patch
does the trick.
Just to clarify something for the benefit of others who might follow
this thread: your "client character set" entry in freetds.conf declares
the encoding your client uses. It tells FreeTDS what to send to the
client, and how to interpret what it gets from the client. The only
right answer reflects what you get back from locale(1).
There is no freetds.conf entry for server-side encoding, because the
server tells us everything we need to know (whether or not we DTRT).
How we interpret what the server tells us is recorded at the top of the
For correctly written applications, the "client character set" entry
should eventually become obsolete. Unfortunately, that's much easier
said than (portably) done. Here's a GPL example from Bruno Haible:
But the basic logic isn't too bad: use nl_langinfo(CODESET) if
available, else setlocale(LC_CTYPE, NULL), leaving the freetds.conf
entry as an override. That would take care of most people.
The information contained in this transmission may contain privileged and confidential information 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.
More information about the FreeTDS