Question about formatting/(CR/LF) in PERL 
Author Message
 Question about formatting/(CR/LF) in PERL

Hi.  Alright, here's a brief synopsis of my problem.  I've got a script
that's fetching files from the net, using the IO::Socket package.  Now, it
works fine, except when it comes to getting an image file.  When I read the
file requested and output it to a file, there's an extra chr(13) for every
chr(10) in the file.  I've tried cutting off the last character in the line
and readding it (since it's always a chr(10)), and always get a
chr(10).chr(13) instead of the chr(10).  Is this a bug?  I mean, try this
program here:

print chr(10);

and redirect the output to a file, and look at that file in your most
trusted Hex editor and you'll find that it's actually 0A0D (or
chr(10).chr(13)) even though it's only supposed to be an 0A.  I'm using
Winblows 95...so could this just be a Microsoft thing?  Is there any ways
around this?  If not, how do I retrieve a file using HTTP on the net without
changing its format at all and without using FTP?  Thanks for any help that
could be provided  :)



Thu, 17 Jan 2002 03:00:00 GMT  
 Question about formatting/(CR/LF) in PERL

  P> Hi.  Alright, here's a brief synopsis of my problem.  I've got a
  P> script that's fetching files from the net, using the IO::Socket
  P> package.  Now, it works fine, except when it comes to getting an
  P> image file.  When I read the file requested and output it to a
  P> file, there's an extra chr(13) for every chr(10) in the file.  I've
  P> tried cutting off the last character in the line and readding it
  P> (since it's always a chr(10)), and always get a chr(10).chr(13)
  P> instead of the chr(10).  Is this a bug?  I mean, try this program
  P> here:

  P> changing its format at all and without using FTP?  Thanks for any
  P> help that could be provided :)

read up on binmode in perl and binary/text modes in ftp.

uri

--
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering

Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.



Thu, 17 Jan 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. DOS Perl convering LF to CR/LF

2. Converting LF to CR+LF

3. Perl and CR+LF

4. Cr Lf and Perl for Win NT

5. NT Perl and CR/LF

6. $/ = CR LF?

7. <FILE> and CR-LF

8. Binary data and CR-LF's in MSDOS

9. CR before login or any help that would lf before login

10. CR/LF

11. how to remove cr/lf ???

12. Any Utility in Win32/Win95/Dos to remove CR or LF

 

 
Powered by phpBB® Forum Software