Previously, this didn't work because force_encoding would always be called on the string, which raises an error on frozen strings, even if the forced encoding is the same as the existing encoding.
Now, the encoding is only changed if the given encoding is wrong (non-binary). This means that correctly encoded frozen strings won't be modified.
Previously, this didn't work because
force_encoding
would always be called on the string, which raises an error on frozen strings, even if the forced encoding is the same as the existing encoding.Now, the encoding is only changed if the given encoding is wrong (non-binary). This means that correctly encoded frozen strings won't be modified.