gh-55531: Implement `normalize_encoding` in C by StanFromIreland · Pull Request #136643 · python/cpython
There are some subtle differences between Python and C code.
All of our tests pass, and from my further testing it also matches behaviour, can you please point out such cases?
These are long standing issues that have had no progress for quite a while, I propose, to keep this PR simple/organized and therefore focused on switching the implementation to the existing C code. This PR will become more complex and therefore harder to review if it has to rewrite the existing C code too. The existing issues, and yours from a few days ago, can be addressed in the C implementation, rather than both implementations.