line break issue caused file corruption

258 views Asked by At

I downloaded one zip file from the server using getstore() function in the perl script and unzipped the filed using Unzip method. Now if I try to access that file, I see below error.

ERROR:XXX file corrupted, CR found. Likely cause is file line endings translated from Unix to CR+LF format

No such error was not seen when I manually download the file by clicking hyper-link and unzip it using windows extraction method. Could anybody please explain why it might be happening? Is there anyway we can access the corrupted file using some tool/application?

1

There are 1 answers

1
ikegami On BEST ANSWER

LWP::Simple's getstore writes to disk exactly what was received.

It's your browser that's "corrupting" the file. If you wish to perform the same "corruption" as your web browser, i.e. if you wish to convert DOS line endings to unix line endings, you can use the command line utility dos2unix.

Or you could modify your Perl script to get without storing, convert the line endings, and store the converted result.