friedo has asked for the wisdom of the Perl Monks concerning the following question:
Greetings!
I've run into some confusion with an encoding issue. I'm fetching some files with Mechanize (PDF's in particular) and passing them in-memory to another function, in this case Compress::Zlib::memGzip.
I'm getting the dreaded "wide character in memGzip" warning when I do this, which, if my understanding is correct, tells me a few things:use Compress::Zlib; ... $mech->get( $pdf_url ); my $compressed = Compress::Zlib::memGzip( $mech->content );
- Mechanize (or somebody) is storing the PDF data as a character string
- Since PDF is a byte format, I really don't want it in a character string
- memGzip doesn't want a character string either
- I have to somehow make it not a character string
Mech does have a save_content method which promises to save the content in binary mode if it's not a text/* MIME type (and I've checked that the MIME type is correct.) However, I'd hate to have to dump the content to a temp file just to read it in again.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Dealing with binary data and WWW::Mechanize and encoding stuff
by davidrw (Prior) on Dec 07, 2008 at 15:19 UTC | |
by friedo (Prior) on Dec 07, 2008 at 15:34 UTC | |
Re: Dealing with binary data and WWW::Mechanize and encoding stuff
by Anonymous Monk on Dec 07, 2008 at 08:44 UTC | |
by friedo (Prior) on Dec 07, 2008 at 15:11 UTC |
Back to
Seekers of Perl Wisdom