Re: Determine encoding of file
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