You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But I can get python's compressed blobs to be accepted by node's inflateSync. (And I have experience using python for png formatting, and node for zip file formatting.)
Is this project compliant with the DEFLATE spec?
The text was updated successfully, but these errors were encountered:
Looks like the compressor/decompressor works fine internally, the problem is with test/base64.js. When you use the provided module to base64-encode the compressed data, it treats the input as Unicode codepoints instead of raw bytes.
For example, compressing "Hello" produces bytes [f3 48 cd c9 c9 07 00].
However, the Base64.toBase64() module treats the input as Unicode characters [U00f3 U0048 U00cd U00c9 U00c9 U0007 U0000] and uses UTF-8 to encode them to bytes, resulting in U00f3 ⇒ [c3 b3], U0048 => [48], U00cd ⇒ [c3 8d], and so on.
So after the UTF-8 encoding, you get [c3 b3 48 c3 8d c3 89 c3 89 07 00].
To recover incorrectly encoded data, do the opposite – run it through an UTF-8 decoder:
Using python:
using node.js:
But I can get python's compressed blobs to be accepted by node's
inflateSync
. (And I have experience using python for png formatting, and node for zip file formatting.)Is this project compliant with the DEFLATE spec?
The text was updated successfully, but these errors were encountered: