Re: strcasecmp and multibyte encodings

2013-04-10 Thread Stefan Sperling
On Wed, Apr 10, 2013 at 06:12:01AM -0500, Vladimir Támara Patiño wrote: > Thanks for feedback to Stephan and Matthew. > > Updating patch with all your feedback, and having into account that > n in strncmp counts bytes on s1 (as stated in the thread of > the POSIX list sent byt Matthew). I think y

Re: strcasecmp and multibyte encodings

2013-04-10 Thread Vladimir Támara Patiño
Thanks for feedback to Stephan and Matthew. Updating patch with all your feedback, and having into account that n in strncmp counts bytes on s1 (as stated in the thread of the POSIX list sent byt Matthew). On Tue, Apr 09, 2013 at 11:17:26AM -0700, Matthew Dempsky wrote: These strlen() calls a

Re: strcasecmp and multibyte encodings

2013-04-09 Thread Matthew Dempsky
On Tue, Apr 9, 2013 at 11:10 AM, Stefan Sperling wrote: >> + size_t lus1 = strlen(us1); >> + size_t lus2 = strlen(us2); These strlen() calls are also wrong, because they could read past the n bytes allowed for strncasecmp(). > It seems strncasecmp() cannot return errors a

Re: strcasecmp and multibyte encodings

2013-04-09 Thread Stefan Sperling
On Tue, Apr 09, 2013 at 12:25:23PM -0500, Vladimir Támara Patiño wrote: > Although the behavior of strcasecmp is unsepecified for multibyte > encodings (Is that right?) > http://pubs.opengroup.org/onlinepubs/9699919799/ > > I wish the attached test (encoded in UTF-8) would pass, > so I'm also atta

strcasecmp and multibyte encodings

2013-04-09 Thread Vladimir Támara Patiño
Although the behavior of strcasecmp is unsepecified for multibyte encodings (Is that right?) http://pubs.opengroup.org/onlinepubs/9699919799/ I wish the attached test (encoded in UTF-8) would pass, so I'm also attaching a patch for strcasecmp and strncasecmp that makes this test pass, it uses