*** Entity.pm.orig Thu Nov 13 16:37:23 1997 --- Entity.pm Thu Nov 13 16:39:50 1997 *************** *** 450,455 **** --- 450,458 ---- else { die "can't build entity: no body, and not multipart!"; } + # Check whether we need to binmode(). + my ($maintype, $subtype) = split('/', $type, 2); + $self->bodyhandle->binmode(1) unless $maintype =~ /^text|message$/; } *** Head.pm.orig Thu Nov 13 16:41:20 1997 --- Head.pm Thu Nov 13 16:43:20 1997 *************** *** 214,219 **** --- 214,220 ---- # Parse: open(HDR, $file) or return error("open $file: $!"); + binmode(HDR); # we expect to have \r\n at line ends, and want to keep 'em. $self = $class->new(\*HDR, @opts); # now, $self is instance or undef close(HDR); $self; *** ParserBase.pm.orig Thu Nov 13 16:37:30 1997 --- ParserBase.pm Thu Nov 13 16:38:16 1997 *************** *** 560,566 **** # Open a new bodyhandle for outputting the data: my $body = $self->new_body_for($head); ! $body->binmode unless textlike($head); # no binmode if text! $IO = $body->open("w") or return error "body not opened: $!"; # Decode and save the body (using the decoder): --- 560,566 ---- # Open a new bodyhandle for outputting the data: my $body = $self->new_body_for($head); ! $body->binmode(1) unless textlike($head); # no binmode if text! $IO = $body->open("w") or return error "body not opened: $!"; # Decode and save the body (using the decoder):