bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-gnulib] Re: locale_charset


From: Bruno Haible
Subject: [bug-gnulib] Re: locale_charset
Date: Mon, 13 Dec 2004 22:21:27 +0100
User-agent: KMail/1.5

Simon Josefsson wrote:
> Is this true?  POSIX says:
>
>    The nl_langinfo() function need not be reentrant. A function that
>    is not required to be reentrant is not required to be thread-safe.
>
> I have taken that to mean that you shouldn't call nl_langinfo from
> threaded code

Well, I took my understanding from the glibc and FreeBSD implementations.
I don't know whether Solaris nl_langinfo() is thread-safe.

> There may have been a time where the complexity
> of that function was needed to get things to work in the real world,
> but today I'd rather use nl_langinfo (CODESET) [unless a specification
> argue there is a problem with that].

Woe32 systems don't have nl_langinfo and will not get it in the foreseeable
future. MacOS X also doesn't have a reasonably working nl_langinfo(CODESET).

> Perhaps the locale_charset() module could be turned into a replacement
> for nl_langinfo (CODESET), if a system doesn't have a working
> nl_langinfo (CODESET), instead of providing a completely new API.

Since some programs just use autoconf to determine whether nl_langinfo
is available or not, such a replacement would have to emulate the other
hundred items that can be passed to nl_langinfo, from ABDAY to MONETARY_*.
Which is definitely an order of magnitude more complex than the current
locale_charset module.

> Btw, are nl_langinfo (CODESET) guaranteed to return character set
> names that are understood by iconv, if the system is providing both
> functions?

It is written nowhere. But it is a reasonable expectation.

Bruno





reply via email to

[Prev in Thread] Current Thread [Next in Thread]