[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bug or feature?
Quoting Alexander Taranov:
> Here is a transcript of v103 session:
>
> Welcome to MzScheme version 103.1 (using locale), Copyright (c) 1995-2000 PLT (Matthew Flatt)
> > (string=? "" (string (integer->char 0)))
> #t
> > (string-ci=? "" (string (integer->char 0)))
> #f
> > (string-length (string (integer->char 0)))
> 1
> >
>
> Is it a bug?
Yes, it's a bug in the locale support.
Probably the only people who know about the locale support are
@jet.msk.su; I didn't advertise it more broadly due to the above
problem.
Here's the note in the source:
static int mz_strcmp(unsigned char *str1, int l1, unsigned char *str2, int l2)
{
#ifdef USE_LOCALE
/* USE_LOCALE contributed by Boris Tobotras, tobotras@jet.msk.su. */
/* Caveat emptor. */
/* The problem with using strcoll is that MzScheme strings may
contain a null character. In that case, if the strings match up
to the first null character but differ afterwards, strcoll will
return the wrong result. (This is why we use mz_strcmp instead of
strcmp in the first place.) */
return strcoll(str1, str2);
#else
Generalizing strings to work with locales, unicode, etc. is still on my
to-do list.
Matthew