Project

General

Profile

Actions

Misc #12835

closed

Updated by znz (Kazuhiro NISHIYAMA) over 8 years ago

I created pull request for Japanese Reference Manual.

Updated by stomar (Marcus Stollsteimer) over 8 years ago

Note that String#casecmp can return nil:

"\u{e4 f6 fc}".encode("ISO-8859-1").casecmp("\u{c4 d6 dc}")   #=> nil

The relevant lines in the source code (in string.c):

static VALUE
rb_str_casecmp(VALUE str1, VALUE str2)
{
    /* ... */

    enc = rb_enc_compatible(str1, str2);
    if (!enc) {
        return Qnil;
    }

    /* ... */
}

Updated by stomar (Marcus Stollsteimer) over 8 years ago

I tried to clarify this in the rdoc with r57886.

Updated by stomar (Marcus Stollsteimer) about 8 years ago

  • Status changed from Open to Closed

Closing since the rdoc matches the actual behavior. Additionally I opened a new issue because raising TypeError seems to be inconsistent with other comparison methods, see .

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0