[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Having trouble downloading ShrinkIt archives
> I was told to select Save As Text on a Mac (even though it's not a text
> file). This is the way I've been doing it and it has worked every time.
Well it is a text file in the Apple format (CR after each line) so saving as
such on an Apple computer won't corrupt it. Unfortunately on DOS or Unix
computers they use different text formats (CRLF or LF respectively) and so
it will be corrupted if interpreted as text. This is not difficult to fix.
If it was downloaded on MS-DOS, replace CRLF with CR, and on Unix replace LF
with CR.
By the way CR (carriage return) is ^M (ascii 13) and LF (line feed) is ^J
(ascii 10).
This QBasic program will strip LFs from a file: (MS-DOS to Apple)
DIM BYTE AS STRING*1
LF$ = CHR$(10)
OPEN "file" FOR BINARY AS #1
OPEN "newfile" FOR BINARY AS #2
DO UNTIL EOF(1)
GET #1, , BYTE
IF BYTE <> LF$ THEN PUT #2, , BYTE
LOOP
CLOSE #2
CLOSE #1
Or this one changes LFs to CRs: (Unix to Apple)
DIM BYTE AS STRING*1
CR$ = CHR$(13): LF$ = CHR$(10)
OPEN "file" FOR BINARY AS #1
OPEN "newfile" FOR BINARY AS #2
DO UNTIL EOF(1)
GET #1, , BYTE
IF BYTE = LF$ THEN PUT #2, , CR$ ELSE PUT #2, , BYTE
LOOP
CLOSE #2
CLOSE #1
Simon.