It shouldn't be necessary to force encode a string resulting from String#transform, so I think you've hit an issue with transform here. We should fix String#transform, so we don't need the force_encoding calls here on the resulting string since that should not be necessary.