ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: merch-redmine@jeremyevans.net
To: ruby-core@ruby-lang.org
Subject: [ruby-core:95189] [Ruby master Bug#15816] String#casecmp compares uppercase characters instead of lowercase
Date: Wed, 02 Oct 2019 15:01:56 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-81825.20191002150155.c73829fa493a904c@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-15816.20190501222739@ruby-lang.org

Issue #15816 has been updated by jeremyevans0 (Jeremy Evans).

Status changed from Open to Closed

Fixed in commit:082424ef58116db9663a754157d6c441d60fd101.

----------------------------------------
Bug #15816: String#casecmp compares uppercase characters instead of lowercase
https://bugs.ruby-lang.org/issues/15816#change-81825

* Author: jonathanhefner (Jonathan Hefner)
* Status: Closed
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
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](http://manpages.ubuntu.com/manpages/eoan/man3/strcasecmp.3.html) 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--------------------------------
casecmp-lowercase.patch (1.3 KB)


-- 
https://bugs.ruby-lang.org/

      parent reply	other threads:[~2019-10-02 15:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-15816.20190501222739@ruby-lang.org>
2019-05-01 22:27 ` [ruby-core:92520] [Ruby trunk Bug#15816] String#casecmp compares uppercase characters instead of lowercase jonathan
2019-05-09  3:38 ` [ruby-core:92602] " merch-redmine
2019-05-09  7:35 ` [ruby-core:92610] " mame
2019-05-09  8:01 ` [ruby-core:92611] " nobu
2019-10-02 15:01 ` merch-redmine [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-81825.20191002150155.c73829fa493a904c@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).