Re: ascii string comparison [Re: use C locale for LC_CTYPE]
"corvid" <[email protected]>
| Newsgroups | gmane.comp.web.dillo.devel |
|---|---|
| Message-ID | <20111104024128.GC25712@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.
>
> > and it would make more sense to have a
> > test like checking whether toupper('i') == 'I'.
> >
> > And better than that would be to go through the whole ASCII alphabet
> > at initialization time and see whether everything is as we wish, and
> > then set some ptrs to functions accordingly.
>
> +1
>
> (or just test the subset we know we can handle).
Here's what I ended up with when I added in some initialization on the
dlib side: http://www.dillo.org/test/ascii_strcasecmp2.diff