rubinius/rubinius — pull request #2909 by razielgn (2014-01-28 18:52:21+00:00)
Title: Reset @invalid_encoding slot in String#replace. 

String#replace can be called with a string having an invalid encoding.
Not resetting the slot was causing String#valid_encoding? returning true, while in fact it was not a valid encoding.

Fixed #2899, which in this specific case did not involve `String` subclassing: `String#to_s` calls `String#replace` when `self` is not a `String`, so that explains why it'd show up like that.