String#force_encoding don't clear coderange if encoding is unchanged
Some code out there blind calls force_encoding without checking what the original encoding was, which clears the coderange uselessly.
force_encoding
If the String is big, it can be a rather costly mistake.
For instance the rack-utf8_sanitizer gem does this on request bodies.
rack-utf8_sanitizer
String#force_encoding don't clear coderange if encoding is unchanged
Some code out there blind calls
force_encodingwithout checkingwhat the original encoding was, which clears the coderange uselessly.
If the String is big, it can be a rather costly mistake.
For instance the
rack-utf8_sanitizergem does this on requestbodies.