Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: serving a zip file with Dancer2

by 1nickt (Canon)
on May 14, 2018 at 14:27 UTC ( [id://1214456]=note: print w/replies, xml ) Need Help??


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...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1214456]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2024-04-26 08:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found