On the server side I use python zlib to compress a string as follows:
import zlib
s = '{"foo": "bar"}'
compress = zlib.compress(s)
print compress
The result of the previous code is the following
xœ«VJËÏW²RPJJ,Rª
On the client side I use zlib.js to decompress
var s = "xœ«VJËÏW²RPJJ,Rª"
var data = new Array(s.length);
for (i = 0, il = s.length; i < il; ++i) {
data[i] = s.charCodeAt(i);
}
var inflate = new Zlib.Inflate(data);
I get the following error
zlib_and_gzip.min.js:1 Uncaught Error: invalid fcheck flag:28
at new tb (zlib_and_gzip.min.js:48)
at <anonymous>:1:15
what am I doing wrong?
var s = 'x\x9c\xabVJ\xcb\xcfW\xb2RPJJ,R\xaa\x05\x00 \x98\x04T'