"Martin" == Martin v Löwis firstname.lastname@example.org writes:
Martin> Stephen J. Turnbull wrote:
>> However, this option should be part of the initialization of an >> IO stream which produces Unicodes, _not_ an operation on >> arbitrary internal strings (whether raw or Unicode).
Martin> With the UTF-8-SIG codec, it would apply to all operation Martin> modes of the codec, whether stream-based or from strings.
I had in mind the ability to treat a string as a stream.
Martin> Whether or not to use the codec would be the application's Martin> choice.
What I think should be provided is a stateful object encapsulating the codec. Ie, to avoid the need to write
out = chunk.encode("utf-8-sig") + chunk.encode("utf-8")