Azure / azure-storage-python

Microsoft Azure Storage Library for Python
https://azure-storage.readthedocs.io
MIT License
338 stars 240 forks source link

Queue Message Encoding Issue #544

Closed plooploops closed 5 years ago

plooploops commented 5 years ago

We're looking to use the Azure Queue Service and wanted to see if it's possible to turn off the encoding in the queue service (either through portal or Python SDK).

This is how the messages are packed and placed into the queue.

def pack(message): dumped = utils.dumps(message) compressed = zlib.compress(dumped.encode('utf8')) b64encoded = base64.b64encode(compressed) return b64encoded.decode('ascii')

We'd like to unpack the messages. When we try to decode this to ascii, we get an error that looks like this:

'ascii' codec can't encode characters in position 1-2: ordinal not in range(128)

So the data looks like this in the queue.

x��\iW۸��_���\ɖ�ӄ@��h��9m&^�e��9�߯dgeBC

image

Is there a way to stop the queue from performing additional encoding?

+@priyaananthasankar

zezha-msft commented 5 years ago

Hi @plooploops, to my understanding, this issue has been resolved offline, is that correct?

If yes, please summarize the solution if you'd like to share it with others, and close this issue.

rickle-msft commented 5 years ago

I believe this issue was resolved offline. Setting the encoding function on the queueservice (queueservice.encoding_function = my_encoding_function) seems to do the trick. I'll close it as I believe it is resolved, but @plooploops should feel free to reopen it if there are further difficulties.