>if not seems like a case for using unless :)

Not a fan of unless, but I can swap it if you'd like.
>Also wondering, shouldn't the actual check here be to see if the replacement encoding is compatible with the current encoding?

I believe that logic has been moved to `String::append` by recent commits.