Message149436
Ram Rachum wrote:
> The `rot_13` codec is supposed to work like this, no?
No it isn't. In Python 3, str.encode() always encodes to bytes and bytes.decode() always decodes to str. IOW, str.encode() encodes text (Unicode) to data (bytes), and bytes.decode() decodes data to text. ROT-13 is not a character encoding, so it cannot be used in this manner.
It's still available in the codecs module, though:
>>> import codecs
>>> codecs.lookup('rot-13').encode('qwerty')
('djregl', 6)
Other text->text and bytes->bytes codecs are also available there. |
|
Date |
User |
Action |
Args |
2011-12-14 09:30:36 | petri.lehtinen | set | recipients:
+ petri.lehtinen, ezio.melotti, cool-RR |
2011-12-14 09:30:36 | petri.lehtinen | set | messageid: <1323855036.52.0.167594584134.issue13600@psf.upfronthosting.co.za> |
2011-12-14 09:30:35 | petri.lehtinen | link | issue13600 messages |
2011-12-14 09:30:35 | petri.lehtinen | create | |
|