• 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: Determine encoding of file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Determine encoding of file


  • Subject: Re: Determine encoding of file
  • From: Rainer Brockerhoff <email@hidden>
  • Date: Fri, 30 Jul 2010 22:14:09 -0300

At 16:06 -0700 30/07/10, email@hidden wrote:
>From: Dave DeLong <email@hidden>
>Date: Fri, 30 Jul 2010 16:09:22 -0600
>Message-ID: <email@hidden>
>...
>Given a file, how can I determine the NSStringEncoding of the file, without reading the entire file into memory?  (If the file isn't a text file, then defaulting to NSUTF8StringEncoding is just fine, since my code will only work properly if I'm working with text files anyway)

Beyond what others have already answered, one example heuristic can be found in this sample code:
http://brockerhoff.net/src/FolderSweep.zip
check the last method in AppController.m.

HTH,
--
Rainer Brockerhoff  <email@hidden>
Belo Horizonte, Brazil
"In the affairs of others even fools are wise
 In their own business even sages err."
Blog: http://brockerhoff.net/blog
_______________________________________________

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

  • Prev by Date: Re: Determine encoding of file
  • Next by Date: Re: Intercepting deletion of NSManagedObjects or how to handle deletion in non-explicit relationships?
  • Previous by thread: Re: Determine encoding of file
  • Next by thread: drawingRectForBounds not being called
  • Index(es):
    • Date
    • Thread