Bug #15816
closedString#casecmp compares uppercase characters instead of lowercase
Description
The current implementation of String#casecmp converts characters to uppercase before comparing them. However, all references I've found for strcasecmp (the C function on which String#casecmp is based) indicate characters should be converted to lowercase before being compared.
For example, this man page says:
The POSIX.1-2008 standard says ... shall behave as if the strings had been converted to lowercase and then a byte comparison performed.
The difference in behavior is apparent when comparing / sorting strings containing [, \, ], ^, _, or ` (the characters that occur between Z and a). Converting to lowercase sorts these punctuation characters before A-z along with most of the other punctuation in ASCII, but converting to uppercase sorts these characters after A-z instead.
Files