Carry over valid_encoding? value in String#replace.