RE: ^M in $res->content

Burdette Lamar (Burdette.Lamar@telescan.com)
Tue, 12 Oct 1999 12:42:14 -0500


The substitution Ray suggests works fine for me when the content is
text/html.

Unfortunately, some unwanted '\r' characters are inserted into $res->content
even when
the content is image/jpeg or image/gif -- or, presumably, other binary.

A workaround is to take the content via $res->as_string. The returned value
begins with the
HTTP header info for the response. Everything up to the first blank line (as
I recall), is header
info. Everything after that blank line is the actual content, whether text
or binary, and doesn't
have the unwanted '\r' characters in it.

> -----Original Message-----
> From:	RayG [SMTP:rgoldber@eb.com]
> Sent:	Tuesday, October 12, 1999 7:43 AM
> To:	libwww-perl@ics.uci.edu
> Subject:	Re: ^M in $res->content
> 
> On Tue, 12 Oct 1999, Gunardi -Viriyaguna- Wu wrote:
> 
> > Please help me, is there anyway to get rid of the ^M character? 
> > (preferebly without using any text-parsing/filter script)
> 
> before printing the content do:
> $res->content =~ s#\r##g;