[freetds] How to set locales.conf in spanish

James K. Lowden jklowden at schemamania.org
Sat Jan 11 17:00:44 EST 2003


On Fri, 10 Jan 2003 19:37:25 -0600, Steve Langasek <vorlon at netexpress.net>
wrote:
> On Fri, Jan 10, 2003 at 07:27:50PM -0500, James K. Lowden wrote:
> 
> > I would like to use setlocale(3), but ANSI standardized the signature
> > while saying nothing about its inputs or outputs.  It gets us a step
> > away from $LANG, but only a small amount closer to knowing what
> > character set and language to tell the server to use.  
> 
> Is portability to all ANSI platforms a requirement?  What if locale
> support was limited to SUSv2 platforms?  With SUSv2, you don't have to
> futz with the LANG variable at all; you call setlocale(), call
> nl_langinfo(), and out pops an authoritative character set name.

NetBSD has basically no L10N support, but has included those two libc
functions, as you say,  since 1994, in version 1.0.  I didn't know
nl_langinfo() was standard.  Now I know where to look next time
(http://www.opengroup.org/onlinepubs/007908799/xsh/nl_langinfo.html).  

> I'm not certain how well-supported SUSv2 is; at the very least, I find
> that nl_langinfo() is supported by MacOS X, NetBSD (since 1994 it
> seems), FreeBSD, Linux, AIX (4.3), and Solaris

I for one think that's a reasonable list, as long as the documentation
reflects "SUSv2 compliant systems".  

> I'm strongly in favor of using nl_langinfo(), because it's really not
> FreeTDS's business to map locales to character sets: it's the OS's
> responsibility to do this, and as shown, OSes appear to be living up to
> this.

Sounds good to me, as far as it goes.  Questions:

1.  How standard are the outputs from "nl_langinfo(CODESET)"?  tsql makes
this call and prints the output when it initializes.  On NetBSD, I get
"iso_1", which doesn't match what libiconv would want, for instance.  I
think the answer is "not very": 
http://www.abisource.com/lxr/source/libiconv/libcharset/lib/config.charset

2.  Where do we get the language from?  Don't we still have to parse and
interpret setlocale(3)?  

I still favor reducing language, country, and charset to ISO/iconv
standard strings, then translating those to what Sybase/Microsoft wants. 
And afaict nl_langinfo()'s outputs are not well standardized, albeit more
so than those of setlocale().   

Thanks for the research, Steve.  Are we reaching agreement?  

--jkl





More information about the FreeTDS mailing list