And, of course, as Nick Z and that session point out, you may need to allow the user to choose the encoding somehow in your application, given you can't be 100% accurate when the encoding is unknown.
-- michael On 30 Jul, 2010, at 17:35, Michael Watson wrote: > There's a good session from WWDC 2009, 112 - Text Processing in Cocoa, that > has a segment about guessing encodings without having to read the entire file > (in most cases). It's worth watching, even if it doesn't solve your problem > directly. > > > -- > michael > > On 30 Jul, 2010, at 15:09, Dave DeLong wrote: > >> Hi everyone, >> >> I have a seemingly simple question, but I haven't been able to figure it out. >> >> 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) >> >> I've found this: >> http://www.macosxguru.net/article.php?story=20030808081801868 but it seems >> ridiculously complex... >> >> Thanks, >> >> Dave_______________________________________________ >> >> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >> >> 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: >> http://lists.apple.com/mailman/options/cocoa-dev/mikey-san%40bungie.org >> >> This email sent to mikey-...@bungie.org > _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com