bug in strcasecmp and strncasecmp

Corinna Vinschen corinna-cygwin@cygwin.com
Mon Feb 17 11:51:38 GMT 2025


On Feb 17 11:49, Bruno Haible via Cygwin wrote:
> Corinna Vinschen wrote:
> > Adding a cast fixes that and I just pushed a matching patch.
> 
> Thanks.
> 
> > I'm just not sure if that's sufficient in the light of POSIX.1-2024.
> > The above expression seems to indicate that strcasecmp and friends are
> > now expected to work on multibyte codesets like UTF-8.
> 
> They can't work on multibyte strings. This is evident from the fact that
> strncasecmp gets one integer as argument, not two integers.

Good point.

With standard functions, one really should convert MB string to wide
char and call wcscasecmp, etc.


Thanks,
Corinna


More information about the Cygwin mailing list