Project

General

Profile

« Previous | Next » 

Revision ea1b1ea1

Added by byroot (Jean Boussier) about 2 years ago

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.

If the String is big, it can be a rather costly mistake.

For instance the rack-utf8_sanitizer gem does this on request
bodies.