Re: How to detect string encoding before reading a file in NSString?
Re: How to detect string encoding before reading a file in NSString?
- Subject: Re: How to detect string encoding before reading a file in NSString?
- From: Heath Borders <email@hidden>
- Date: Tue, 26 Apr 2011 13:20:43 -0500
Obviously, there are sometimes overlaps between encodings when you're
trying to guess.
http://en.wikipedia.org/wiki/Bush_hid_the_facts
-Heath Borders
email@hidden
Twitter: heathborders
http://heath-tech.blogspot.com
On Tue, Apr 26, 2011 at 1:18 PM, Dave DeLong <email@hidden> wrote:
> You'd have to guess (by reading the first few bytes of the file, seeing what they are and how they're laid out, etc), or use the initWithContentsOfFile:usedEncoding:error: variant to let NSString guess for you.
>
> Dave
>
> On Apr 26, 2011, at 11:13 AM, Laurent Daudelin wrote:
>
>> I've found different ways to do that (some pure Cocoa, some using Carbon) but I was wondering about the wisdom of this list as to what is the best way to detect the encoding of a file before passing it to NSString initWithContentsOfFile:encoding:error:?
>>
>> -Laurent.
>> --
>> Laurent Daudelin
>> AIM/iChat/Skype:LaurentDaudelin http://www.nemesys-soft.com/
>> Logiciels Nemesys Software email@hidden
>>
>> _______________________________________________
>>
>> 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
>
> _______________________________________________
>
> 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
>
_______________________________________________
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