In my tests, Python can parse both Adler-32 and CRC32, while PHP can
only do Adler-32.
Anyways, I shortened my function:
function fixAdler32($data) {
static $f;
if (!isset($f)) $f = tempnam('/tmp', 'gz_fix');
file_put_contents($f, "\x1f\x8b\x
They're exactly the same, except of the last 4 bytes. Python
calculates them differently than PHP. PHP follows the standards,
Python does not :]
This would be more concise if PHP included the gzdecode
(http://us2.php.net/gzdecode) function.
On Nov 7, 2007 12:12 AM, Per Jessen <[EMAIL PROTECTED]>
[EMAIL PROTECTED] wrote:
> They're exactly the same, except of the last 4 bytes. Python
> calculates them differently than PHP. PHP follows the standards,
> Python does not :]
That is exactly what is so weird - does Python maybe have its own
implementation of the gzip compression algorithm? I w
[EMAIL PROTECTED] wrote:
> The documentation for zlib says that it expects an Adler-32 checksum
> at the end of the file.
>
> PHP follows this [largely outdated] standard.
Uh, nothing to do with PHP, the code is in zlib.
> Python, on the other hand, doesn't, and uses a different checksum,
> CR
The documentation for zlib says that it expects an Adler-32 checksum
at the end of the file.
PHP follows this [largely outdated] standard.
Python, on the other hand, doesn't, and uses a different checksum, CRC-32.
That's why it won't decompress. But I've written my own function and
it's working
[EMAIL PROTECTED] wrote:
> Alright, I think I know the problem.
>
> PHP's gzuncompress uses the Adler-32 checksum at the end of the zlib,
> while Python uses CRC32.
>
> Why must you follow the standards, PHP!?
>
> Does anyone know of any workaround?
Are you saying that you've got compressed da
Alright, I think I know the problem.
PHP's gzuncompress uses the Adler-32 checksum at the end of the zlib,
while Python uses CRC32.
Why must you follow the standards, PHP!?
Does anyone know of any workaround?
On Nov 6, 2007 7:03 AM, <[EMAIL PROTECTED]> wrote:
> I left that empty. The decompres
I left that empty. The decompressed string is about 224 KB, so it
shouldn't throw an error. Thanks for the reply!
On Nov 6, 2007 12:25 AM, Per Jessen <[EMAIL PROTECTED]> wrote:
> Casey wrote:
>
> > When I try gzuncompress() on the same data (I checked), it returns a
> > "Data error". I also trie
Casey wrote:
> When I try gzuncompress() on the same data (I checked), it returns a
> "Data error". I also tried gzinflate() and many user-created gzdecode
> () functions, with no luck.
Did you specify a correct length for gzuncompress() ?
>From the manpage:
The function will return an error if
9 matches
Mail list logo