develooper Front page | perl.perl5.porters | Postings from March 2001

Re: [ID 20010225.003] inconsistencies in locale support

Thread Previous | Thread Next
From:
Jarkko Hietaniemi
Date:
March 2, 2001 07:22
Subject:
Re: [ID 20010225.003] inconsistencies in locale support
Message ID:
20010302092141.C18888@chaos.wustl.edu
On Fri, Mar 02, 2001 at 10:15:06AM -0500, Andrew Pimlott wrote:
> On Mon, Feb 26, 2001 at 07:13:48PM -0500, Andrew Pimlott wrote:
> > On Mon, Feb 26, 2001 at 11:44:27PM +0000, Simon Cozens wrote:
> > > On Mon, Feb 26, 2001 at 06:31:50PM -0500, Andrew Pimlott wrote:
> > > > The reason is that isalpha is implemented as .xs code, while tolower
> > > > is a pure Perl subroutine that calls lc. 
> > > 
> > > Urgh, that's a bug. tolower in POSIX should call the underlying C routine.
> > > POSIX.pm things should be POSIXish first and Perlish second.
> > 
> > As for which ones need to be in C for locale purposes, aside from
> > tolower and toupper, the only candidate I see (that is actually
> > implemented) is strerror.
> 
> FWIW, I took a quick look at this but gave up.  For toupper and
> tolower, I thought I could just make them aliases to CORE::uc and
> CORE::lc, but I discovered you can't do that in Perl, and I'm not up
> to figuring out the XS method.  For strerror, I discovered that it
> already "works", but only because locale is not properly lexically
> scoped.  That is, there are many places where perl must call
> locale-aware C functions (like strerror()), but perl doesn't turn on
> and off C locale support (with setlocale()) by locale scope.  (I
> infer from this that nobody's interested in getting locale support
> 100% right anyway.)

I'm somewhat interested, but 100%, I dunno, that means being fully
compliant with a buggy concept and usually a buggy implementation of
that buggy concept, I dunno whether that's a lofty goal... If you can
point out some of the spots where setlocale() acrobatics would be
needed, I can take a look them.

> Andrew

-- 
$jhi++; # http://www.iki.fi/jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About