OZONE Asylum
FAQ
Why do I get a lot of whitespace in my files/code when I uploaded and download files?
This page's ID:
5397
Search
QuickChanges
Forums
FAQ
Archives
Register
You are editing "Why do I get a lot of whitespace in my files/code when I uploaded and download files?"
Who can edit an FAQ?
Anyone registered may edit an FAQ.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
This has to do with the various types of hard returns/line feeds used by different Operating Systems and occurs when users are FTPing or sharing files (usually of a plain text format) that were created on different OSes. This is a reply given to JKMabry's request for help on his host's board: [quote] Windows use a CR/LF pair for the end of a line, while Linux uses just a LF. The extra lines are added when you upload a text file from a Windows computer to a Linux computer in binary mode, and download it back to the Windows computer in ASCII mode. The text file becomes corrupted because for each LF character in the file, ASCII mode puts a CR before it, whether or not there are any CR characters already before the LF character. The file remains corrupted until you remove the extra CR characters. To remove the extra CR characters, download the text file from the Linux computer as BINARY then upload it to the Linux computer as ASCII, and download to Windows computer again as ASCII. ie Windows "textCRLF" (BINARY mode)-> Linux "textCRLF" = OOPS! Linux "textCRLF" (ASCII mode)-> Windows "textCRCRLF" = DOUBLE OOPS! Windows "textCRCRLF" (BINARY mode)-> Linux "textCRCRLF" = TRIPLE OOPS! Linux "textCRCRLF" (BINARY mode)-> Windows "textCRCRLF" = NOT OK YET Windows "textCRCRLF" (ASCII mode)-> Linux "textLF" OK on Linux Linux "textLF" (ASCII mode)-> Windows "textCRLF" = OK on Windows And, to add to the confusion, Apple systems (from the ancient Apple II to the latest MacOS) use CR by itself as the line break character, so that you can have even more wild and wonderful forms of file corruption if a Mac has been somewhere in the file's history. (I think the Commodore 64 also used CR alone, along with even weirder perversions of ASCII, but that's ancient history.) Surprisingly, of all of these systems, it's actually the ones from Microsoft that got the standards right (a rare thing for MS)... the traditional line break sequence, dating back to ancient Teletypes and continuing on mainframe systems like the DECSYSTEM-20, is CR+LF, with the CR signifying that the cursor should move to the start of the line and the LF indicating that it should jump down to the next line. The decoupling of the two operations instead of having one imply the other was one of those "seemed like a good idea at the time" things for the early standards-makers, as it enabled some special effects on Teletype terminals like using a CR without LF to overstrike things on the current line, but later programmers though it wasteful and decided the newline should be a single character, but couldn't be consistent about which one, unfortunately. [/quote] ------------------------------- Relevant threads: [url=http://www.ozoneasylum.com/Forum1/HTML/005852.html]extra hard returns in code after FTP transfer?[/url] _______________________ [internallink=4626]Emperor[/internallink] [small][i](Added by: [url=http://www.ozoneasylum.com/cgi-bin/ubbmisc.cgi?action=getbio&UserName=Emperor]Emperor [/url] on Wed 06-Nov-2002)[/i][/small]
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »