This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients pitrou, sjmachin, vstinner
Date 2008-12-13.17:03:05
SpamBayes Score 3.9821905e-05
Marked as misclassified No
Message-id <1229187787.13.0.5546498724.issue4574@psf.upfronthosting.co.za>
In-reply-to
Content
A couple of suggestions:

- if IncrementalNewlineDecoder gets an encoding argument, it can also
instantiate the decoder itself; that way the API is a bit simpler

- to encode '\r' without the BOM, you can e.g. use an incremental
encoder and encode it twice:
>>> enc = codecs.getincrementalencoder('utf16')('strict')
>>> enc.encode('\r')
b'\xff\xfe\r\x00'
>>> enc.encode('\r')
b'\r\x00'


I think breaking the API can be ok since the original API is broken
(witness this bug). There can even be a compatibility mode where we
check whether `encoding` has an encode() method, and if it has, take it
as the decoder object rather than the encoding name.
History
Date User Action Args
2008-12-13 17:03:07pitrousetrecipients: + pitrou, sjmachin, vstinner
2008-12-13 17:03:07pitrousetmessageid: <1229187787.13.0.5546498724.issue4574@psf.upfronthosting.co.za>
2008-12-13 17:03:06pitroulinkissue4574 messages
2008-12-13 17:03:05pitroucreate