Also wondering, shouldn't the actual check here be to see if the replacement encoding is compatible with the current encoding?