Re: strxfrm() broken?

From: Tim Robbins <tjr_at_FreeBSD.ORG>
Date: Mon, 21 Apr 2003 17:53:47 +1000
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.).


Tim
Received on Sun Apr 20 2003 - 22:54:00 UTC

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