I'm trying to use `gzip-through-ports` and I haven't been able to
unzip compressed data.

Here's a tiny example. I think this should print "hello world":

```
#lang racket

(require
  (only-in file/gzip gzip-through-ports)
  (only-in file/gunzip gunzip-through-ports))

(define src "hello world")

(define (compress str)
  (call-with-output-string
    (lambda (out-port)
      (call-with-input-string str
        (lambda (in-port)
          (gzip-through-ports in-port out-port #f 0))))))

(define (decompress str)
  (call-with-output-string
    (lambda (out-port)
      (call-with-input-string str
        (lambda (in-port)
          (gunzip-through-ports in-port out-port))))))

(define tgt (decompress (compress src)))

(displayln tgt)
```

But instead, it stops with "gnu-unzip: bad header"

The source code says that the header is the first two bytes, and these
should be #o037 and #o213. But in my compressed string, the second
byte is #o357 for some reason. I'm not sure how that could have
happened ... some kind of encoding issue with string ports?

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAFUu9R4%3DEPphxb44odmqYe9naSWuX7pu7KO0vGqRws537jGZBw%40mail.gmail.com.

Reply via email to