Date: Mon, 21 Apr 2003 17:53:47 +1000 From: Tim Robbins <tjr@FreeBSD.ORG> To: Joe Marcus Clarke <marcus@marcuscom.com> Cc: current@freebsd.org Subject: Re: strxfrm() broken? Message-ID: <20030421175347.B41423@dilbert.robbins.dropbear.id.au> In-Reply-To: <1050907939.9550.68.camel@shumai.marcuscom.com>; from marcus@marcuscom.com on Mon, Apr 21, 2003 at 02:52:20AM -0400 References: <1050907939.9550.68.camel@shumai.marcuscom.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Apr 21, 2003 at 02:52:20AM -0400, Joe Marcus Clarke wrote: > I'm posting this to current@ 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030421175347.B41423>