Re: Best way to save a simple text file?
Re: Best way to save a simple text file?
- Subject: Re: Best way to save a simple text file?
- From: Martin Wierschin <email@hidden>
- Date: Fri, 16 Nov 2007 16:56:05 -0800
The best way to save a string to a text file is to use -[NSString
writeToURL:atomically:encoding:error:], or the corresponding method
taking a path. This is even more important on Leopard, because on
Leopard NSString will tag the file with an extended attribute
specifying the encoding, so that it can be opened properly by
TextEdit and anything else using Cocoa APIs to load text files.
Unfortunately that method doesn't allow for controlling whether the
save can be lossy or not. Is there a way to manually set the text
encoding file attribute after using the NSData method? I don't see a
constant for the atribute in NSFileManager.
~Martin
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden