• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Best way to save a simple text file?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Best way to save a simple text file?
      • From: Ali Ozer <email@hidden>
References: 
 >Best way to save a simple text file? (From: Jean-Nicolas Jolivet <email@hidden>)
 >Re: Best way to save a simple text file? (From: Douglas Davidson <email@hidden>)

  • Prev by Date: Re: Frontmost window
  • Next by Date: Re: Frontmost window
  • Previous by thread: Re: Best way to save a simple text file?
  • Next by thread: Re: Best way to save a simple text file?
  • Index(es):
    • Date
    • Thread