I recently rediscovered this strange behaviour in Python’s Unicode handling.—Evan
Yes!—Stephen

However, if there is an utf-8-sig codec for streams, there is currently no way of preventing this codec to also be available for strings. The very same code is used for streams and for strings, and automatically so.

Regards, Martin—"Martin

And of course it should be. But if it’s not possible to move the -sig facility out of the codecs into the streams, that would be a shame. I think we should encourage people to use streams where initialization or finalization semantics are non-trivial, as they are with signatures.

But as long as both utf-8-we-dont-need-no-steenkin-sigs-in-strings and utf-8-sig are available, I can program as I want to (and refer those whose strings get cratered by stray BOMs to you<wink>).—Stephen