Skip to content
Prev 206360 / 398503 Next

memDecompress and zlib compressed base64 encoded string

On Thu, 14 Jan 2010, Johannes Graumann wrote:

            
What is that file? Not gzip compression:

gannet% file compressed.txt
compressed.txt: ASCII text, with very long lines

since gzip uses a magic header that 'file' knows about.  And even if 
the header was stripped, such files are 8-bit and yours is ASCII.
Try
[1] "x\x9c\xf3\xca\xcfH\xcc\xcbK-Vp/J,\xcd\0052\001:\n\006\x90"

to see what a real gzipped string looks like.
You have not told us the 'at a minimum' information requested in the 
posting guide.  But you should not expect that to read a binary file, 
especially not in a MBCS locale.  We have readBin for that purpose.
I don't think you know what as.raw does: it does not convert bytes in 
a character string to raw (for which you need charToRaw).

It is always a good idea to look at each stage of your computation:
[1] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00
[26] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00