Re: GCC3?
Re: GCC3?
- Subject: Re: GCC3?
- From: Phill Kelley <email@hidden>
- Date: Tue, 12 Aug 2003 12:05:42 +1000
At various times, Prachi Gauriar, Douglas Davidson, M. Uli Kusterer have
written:
>
>
>>> Speaking of inconsistencies in line endings, the thread on this list
>
>>> regarding that seems to have left out that point. If you open a file
>
>>> with Windows line endings in TextEdit and add some new lines, don't
>
>>> try to read that file in Windows without first going in with BBEdit
>
>>> or CodeWarrior and manually repairing every line. As far as I can
>
>>> tell, this is a problem endemic to the entire Cocoa text system.
>
>>
>
>> The problem is that Cocoa will generate line endings in whatever
>
>> format the current OS uses natively, which is 0x0D on Mac. Since you
>
>> didn't convert the text beforehand, you end up with mixed line feeds.
>
>> Cocoa is guilty merely in that it lets you get away with displaying
>
>> foreign line endings, and maybe because it doesn't warn you.
>
>>
>
> An application could detect this situation and offer to convert line
>
> terminations for you. The text system could perhaps help with this,
>
> but since the appropriate behavior depends heavily on context, it
>
> would not be appropriate for it to do so automatically. It it
>
> something that should be fairly straightforward for an application to
>
> do, provided that one can determine what the right behavior is.
<shameless promotion>
Having been a Mac holdout in various Wintel companies for the last 15
years, I found it simplest to write an app to fix these kinds of problems.
You can find this piece of $10 shareware at:
http://www.lgosys.com/products/stripper.html
Select the radio-button for the kind of line-endings you want (Mac OS X =
LF, Mac OS 9 = CR, Windows = CR+LF), then drag one or more text files onto
the application window. Stripper doesn't care what kind of line-endings are
present in the original files. Neither does it care if a file has a mixture
of line-endings. Stripper doesn't even care if some twit of a Windows
programmer has created lines ending in LF+CR instead of the usual CR+LF.
Stripper simply conforms all the line-endings in the file for the target
environment.
If you've got a ton of files to convert and a multi-processor Mac, Stripper
will even use both processors to churn through the task (many thanks are
due here to Messrs Anguish, Buck and Yacktman for their excellent book
including the thorough explanation of Distributed Objects and threading).
</shameless promotion>
Regards, PK
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: | |
| >Re: GCC3? (From: Douglas Davidson <email@hidden>) |
| >Re: GCC3? (From: Prachi Gauriar <email@hidden>) |