Hi Marc, Wish this thread existed 2 years ago. :-) But I digress..
You may also consider using the alternative approach of getting the user to select the most readable encoding (after you've tried automatically detecting it) and floating the most appropriate/most frequently used encodings on top. A screenshot of that approach in action in my app: http://funkeemonk.cachefly.net/international.png Good luck! Joe Goh FunkeeMonk Technology http://www.funkeemonk.com/ On 5/9/08, "Gary L. Wade" <[EMAIL PROTECTED]> wrote: > Sorry, I misread your suggested method, but, as Adam points out, it still > isn't > adequate for someone who has free-styled 8-bit text with no idea what the > original > encoding was. > > > > >On Wednesday, May 07, 2008, at 12:37PM, "Jean-Daniel Dupas" > ><[EMAIL PROTECTED]> wrote: > >>What make you think this function assumes an exact encoding ? This > >>method is not the same than +[NSString > >>stringWithContentsOfFile:encoding:error:]. > >> > >>The method +stringWithContentsOfFile:usedEncoding:error: returns the > >>sniffed encoding by reference using the second argument. At least > >>that's what the documentation says: “ This method attempts to > >>determine the encoding of the file at path.†> >>This method was introduced in Tiger, that's maybe why you never see it > >>before. > > > >Unfortunately, that method doesn't work unless you have UTF-16 or UTF-32 > with > >a BOM on Tiger, which makes it less useful than it might be. On Leopard it > >reads xattrs, then tries UTF-8 if it's not UTF-16/32, but it certainly > doesn't > >sniff encodings like TEC. I was never motivated enough to figure out TEC, > so > >basically ended up checking for BOM, trying UTF-8, and then using MacRoman > if > >all else failed. > > > >-- > >adam _______________________________________________ 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 [EMAIL PROTECTED]