Message77755
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. |
|
Date |
User |
Action |
Args |
2008-12-13 17:03:07 | pitrou | set | recipients:
+ pitrou, sjmachin, vstinner |
2008-12-13 17:03:07 | pitrou | set | messageid: <1229187787.13.0.5546498724.issue4574@psf.upfronthosting.co.za> |
2008-12-13 17:03:06 | pitrou | link | issue4574 messages |
2008-12-13 17:03:05 | pitrou | create | |
|