-
Notifications
You must be signed in to change notification settings - Fork 114
Open
Labels
Description
Pull request #57 adds python 3 compatibility, but always tries to decode job bodies. Given that arbitrary byte strings may be put in the body, this is suboptimal.
For other protocol messages, only ascii content is accepted, so encoding/decoding automatically is fine.
I propose the following:
- Add an 'encoding' attribute to
Connection.__init__, defaulting tosys.getdefaultencoding
For put:
- When you put a bytes objects it's put as-is
- Otherwise it's encoded with the encoding above
And for reseve/peek etc. (_read_body):
- When a body is read:
- If encoding is
None, return a bytes object - Otherwise decode with the specified encoding and return a string
- If encoding is
If this design is acceptable, I'll rebase and amend the pull request to follow this design.