Re: strxfrm() broken?

From: Joe Marcus Clarke <marcus_at_marcuscom.com>
Date: 21 Apr 2003 12:08:36 -0400
On Mon, 2003-04-21 at 03:53, Tim Robbins wrote:
> On Mon, Apr 21, 2003 at 02:52:20AM -0400, Joe Marcus Clarke wrote:
> 
> > I'm posting this to current_at_ as that's where I first discovered the
> > problem.  However, -STABLE seems to be affected as well.  The attached
> > example code demonstrates the problem pretty well.  It seems that when
> > LANG, LC_ALL, or LC_COLLATE is set to anything other than C or POSIX
> > (e.g. en_US.ISO8859-1), strxfrm() returns garbage.  I think I'm using it
> > correctly (actually glib is the one that pointed me this way).  Is there
> > anything wrong in the attached code, or is strxfrm() truly broken? 
> > Thanks.
> 
> What do you think is wrong with the output? What strxfrm() essentially does on
> FreeBSD is to convert each input character into its primary collation weight.
> In the "C" locale, each character's collation weight is the same as its
> character code, as the second result from your program shows. In other
> locales, there is not necessarily any such correspondence between character
> codes and collation weights. You should only really be comparing the result
> of strxfrm() on different strings (with strcmp() etc.).

Thanks for the response.  It never fails that after you send an email,
you find information that shows you have no idea what you're talking
about.  I was mistaken, and found that I was mislead by how the app in
question was using the collation key.  In any event, the bug is fixed
where it should be fixed, and I feel like a moron.  Sorry for the noise.

Joe

> 
> 
> Tim
-- 
PGP Key : http://www.marcuscom.com/pgp.asc



Received on Mon Apr 21 2003 - 07:08:49 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:04 UTC