String#gsub and String#gsub! should raise ArgumentError on invalid encoding

Calling String#gsub and String#gsub! on a string with invalid encoding
should raise ArgumentError.

Discovered when running the svenfuchs/i18n test suite.