On Sun, 14 Dec 2008 11:57:55 +1100, Michael Selig <michael.selig / fs.com.au> wrote: > - String#> and String#< are a bit weird. Normally they are just done on > a byte-by-byte basis, UNLESS the strings are the same and are > incompatible encodings, then they always seem to return FALSE. (I have > to check this - it may be more complicated than this). Actually I just checked this, and this is wrong, sorry. I ended up looking at the source code of rb_str_cmp() in string.c, and here is what I think it does: - it does a byte-by-byte comparison. Assuming the strings are different, Ruby returns what you would expect based on this. - if the strings are byte for byte identical, but they have incompatible encodings and at least one of the strings contains a non-ASCII character, then it seems that the result is determined by the ordering of the encodings, based on ruby's "encoding index" - an internal ordering of the available encodings. Maybe I have got this wrong - it doesn't make a lot of sense to me! Cheers Mike