-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
Description
Bug report
Bug description:
There's in the codecs module an option for charbuffertype which allows bytes<->bytes codecs, but if there were a type for the encoded value, it would allow cleaner implementation of str<->str codecs, or more...
Most codecs in CPython use decoded str and encoded bytes, there are also codecs that have decoded bytes and encoded bytes, like base64 (note that a base64 codec arguably could be one that considers decoded bytes and encoded str).
I had been more or less perverting the codecs module to implement things like COBS (fundamentally bytes<->bytes), bubblebabble (I did bytes<->bytes but it should encode to str), and recently ANSI escape filtering, as a str<->str codec that works by implementing a virtual terminal, with a screen buffer. To make it work I only had to do self.bytebuffer = ""
in the StreamReader constructor, but since there's a charbuffertype, maybe we could use a bytesbuffertype, and open the flood gates to all kinds of creative abuse.
CPython versions tested on:
3.12
Operating systems tested on:
Linux
Metadata
Metadata
Assignees
Labels
Projects
Status