Add specs for String#gsub and String#gsub! on invalid encodings.

Calling String#gsub and String#gsub! on a string with invalid encoding
should raise ArgumentError.
Handle invalid encodings when calling String#gsub and String#gsub!
Ensure to reset valid and ascii_only flags when setting encoding
Merge branch 'razielgn-feature-gsub-raise-on-invalid-encoding'