in reply to serving a zip file with Dancer2

Hi, just a guess: do you have the charset set in your config?

charset: UTF-8
If so, the output may be getting double-encoded since you add a charset manually in your Content-Type header?

As for idiomatic, I don't work with compressed files myself but I can say that middlewares are ususally the right approach to this type of intermediate content handling, see eg Plack::Middleware::Deflater (which compresses outgoing content).

Hope this helps!


The way forward always starts with a minimal test.

Replies are listed 'Best First'.
Re^2: serving a zip file with Dancer2
by morgon (Priest) on May 14, 2018 at 14:33 UTC
    Yes, some double-encoding is what I suspect.

    But I don't use a config at the moment - it's just a script that I run via plackup.

    I have tried to add

    config->{charset} = "UTF-8";
    to the script but that does not change anything.

    I guess the problem is that I need to tell Dancer that the content I get from the zip-file is already encoded but I can't figure out how.

    I currently try to use a Dancer2::Core::Response-object but I can't make that work at all...