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]

Reply via email to