Re: ascii string comparison [Re: use C locale for LC_CTYPE]

"corvid" <[email protected]>
Newsgroups gmane.comp.web.dillo.devel
Message-ID <20111031204712.GA11003@local>
Jorge wrote:
> On Mon, Oct 31, 2011 at 04:03:38AM +0000, corvid wrote:
> > Jorge wrote:
> > >   From a distance this global change looks to me like exposing ourselves
> > > to more troubles. In other words, why not:
> > > 
> > >      int dStrcasecmp(...)
> > >      {
> > >         if (locale has special rules)
> > >            special treatment
> > >         else
> > >            strcasecmp(...)
> > >      }
> > > 
> > >   Disclaimer: I haven't studied the problem in detail.
> > 
> > Having to know about the locales would be trouble.
> > Judging by the wikipedia page, we'd have to look for 'tr' and 'az'
> > for sure, and they've been considering switching back to Latin
> > script in Kazakhstan, and probably not Tatar because they're mostly
> > Cyrillic, but probably yes to Crimean Tatar because it looks like
> > they're a bit more Latin than Cyrillic at the moment.
> > 
> > So it's a touchy enough situation that different libc's may have
> > different ideas of it all, and individual ones will change as
> > circumstances change,
> 
>   If libc has not nailed it already, it must be hard to solve
> the problem in a generic way.

There are strcasecmp_l() and strncasecmp_l(), but they were only
introduced in a very recent version of posix.

http://www.gnu.org/s/hello/manual/gnulib/strcasecmp_005fl.html
says "This function is missing on many platforms: MacOS X 10.3,
FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
OSF/1 5.1, Solaris 11 2010-11, Cygwin, mingw, Interix 3.5, BeOS."

As for whether strcasecmp_l() is cheap, in any case, I don't know.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.