Added spec on String#replace with strings having an invalid encoding.
Carry over valid_encoding? value in String#replace.
Merge pull request #2909 from razielgn/string-replace-valid-encoding

Carry over valid_encoding? value in String#replace