Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Newlines: reading files that were created on other platforms

by tbone1 (Monsignor)
on Feb 02, 2005 at 13:04 UTC ( [id://427229] : note . print w/replies, xml ) Need Help??


in reply to Newlines: reading files that were created on other platforms

Is the person using OS X or the older Mac OS? OS X is BSD Unix underneath, so it should have just the newline "\n".

Really, though, the problem is probably in the FTPing. I've run into this before, more times than I can count, and the individual needs to be sure to transfer the file in ASCII mode. Any FTP program worthy of the name should know to handle that. In fact, by correcting the user, you might save problems later on another mixed-platform project.

Just my $.02.

--
tbone1, YAPS (Yet Another Perl Schlub)
And remember, if he succeeds, so what.
- Chick McGee

Replies are listed 'Best First'.
Re^2: Newlines: reading files that were created on other platforms
by ChemBoy (Priest) on Feb 02, 2005 at 21:14 UTC

    Nice theory, but unfortunately incompletely. To maintain backward compatibility with the previous decade-and-change worth of documents, GUI apps in OS X (e.g. TextEdit) generally use the Mac line-ending convention (CR), while BSD-derived command-line programs (e.g. perl) use the Unix one (LF). This could be charitably described as a mess.

    I agree with your solution, though—make FTP work right, and the problem should go away. There might be a more specific solution to this specific problem as well, but absent more details on the nature of the program, it's going to be tough to say anything very helpful.



    If God had meant us to fly, he would *never* have given us the railroads.
        --Michael Flanders