freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "Craig A. Berry" <craigberry AT mac.com>
- To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] setlocale not that ok...
- Date: Mon, 28 Jun 2010 21:28:57 -0500
On Jun 28, 2010, at 9:51 AM, Frediano Ziglio wrote:
Hi,
I think that calling setlocale in a library with locale != NULL is
mainly a bad idea. Doing setlocale change global settings that should
be done by the application not by a library. Setting locale changes
subtle things like sprintf witch application should be prepared to
handle.
I think we should remove setlocale(LC_ALL, "") in src/tds/mem.c and
src/tds/locale.c. Applications like tsql, bsql and similars should
call setlocale by themselves.
I think I understand the argument. The counter-argument is that there is no other portoble way to interrogate the locale except by calling setlocale(LC_ALL, ""). The alternative to not calling it in the library is that any application that also does not call it will be getting the "C" locale, which means forcing US-ASCII as the client character set for any application that doesn't have its own setlocale(LC_ALL, "") call.
We can control what happens in src/apps, but my impression is that most people using FreeTDS are using language bindings or an ODBC driver manager and wouldn't know how to set the locale (or maybe wouldn't have a mechanism for doing so) even if they knew something a couple of layers down needed it.
Maybe we should give up on trying to get the local character set and just use ISO-8859-1 or UTF-8 unless explicitly overridden. That might be less dreadful than having US-ASCII as the default. I don't honestly know what the right thing to do is.
________________________________________
Craig A. Berry
mailto:craigberry AT mac.com
"... getting out of a sonnet is much more
difficult than getting in."
Brad Leithauser
-
[freetds] setlocale not that ok...,
Frediano Ziglio, 06/28/2010
- Re: [freetds] setlocale not that ok..., Christos Zoulas, 06/28/2010
- Re: [freetds] setlocale not that ok..., Craig A. Berry, 06/28/2010
Archive powered by MHonArc 2.6.24.