http://www.perlmonks.org?node_id=396540


in reply to Re^2: Distinguishing text from binary data
in thread Distinguishing text from binary data

No it isn't a file - it's a body of an HTTP response
In that case, is examining the Content-type: header in the response sufficient?

Dave.

Replies are listed 'Best First'.
Re^4: Distinguishing text from binary data
by gothic_mallard (Pilgrim) on Oct 05, 2004 at 11:52 UTC

    I'd tend to agree that the simplest course would probably be to check the headers that came with the data - they should give you the content-type as well as the encoding without you having to make assumptions about what makes the code binary or otherwise.

    --- Jay

    All code is untested unless otherwise stated.