In my project I am using Snappy compression in HTML pages in Python. I am successfully compressing the HTML pages. html_page contains the html string of the website. import json import snappy state_dict["html_page"] = unicode(snappy.compress(html_page),errors="ignore") """ If i miss this unicode function UnicodeDecodeError: 'utf8' codec can't decode byte 0xbc in position 0: unexpected code byte """ ........ ........ return json.dumps(state_dict) But I am facing the problem in uncompressing the compressed data: d = json.loads(mydict) snappy.uncompress(d['html_page'].encode("utf-8")) In [122]: snappy.uncompress(d['html_page'].encode("utf-8")) --------------------------------------------------------------------------- UncompressError Traceback (most recent call last) /home/gridlex/workspace/MatrixInfrastructure/<ipython console> in <module>() UncompressError: An error ocurred while uncompressing the string Can you help me out in Snappy compression and decompression? Or which is the optimal way to compress and decompress for transferring the data over the network? Continue reading...