• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Text encoding issues
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Text encoding issues


  • Subject: Re: Text encoding issues
  • From: Ryan Joseph <email@hidden>
  • Date: Wed, 13 May 2009 09:12:24 +0700

It was under my nose the whole time! Thanks, that TEC sniffer thing wasted an hour of my life.

On May 13, 2009, at 9:02 AM, Dave Geering wrote:

On Wed, May 13, 2009 at 11:53 AM, Ryan Joseph
<email@hidden> wrote:
First question, why is the most obvious and best solution deprecated?
NSString's initWithContentsOfFile: accepts no encoding and appears it is
getting the correct encoding in my tests. Now they want us to use
initWithContentsOfFile:encoding:error: and figure out the encoding
ourselves? Sounds like now every person is going to be writing some
utilities for sniffing encodings.


I think I'm going to use initWithContentsOfFile despite Apple's wishes to do
this myself but I did try the Carbon TEC manager and it appears to have
created a organized list of encodings from the input bytes but it's totally
wrong. The top choice was kTextEncodingJIS_X0208_90 followed by other Asian
encodings for a file a plainly saved as UTF8 from TextEdit. I would say it
was an error but it actually organized that list from the previous list of
200+ available encodings. Does that thing even work?

use -initWithContentsOfFile:usedEncoding:error: (introduced when initWithContentsOfFile: was deprecated)

This way, it not only attempts to determine the encoding for you, but
tells you what encoding it successfully used, and rather than simply
returning nil on error, it gives you the error as well.

HTH

Dave.

Regards, Josef

_______________________________________________

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


References: 
 >Text encoding issues (From: Ryan Joseph <email@hidden>)
 >Re: Text encoding issues (From: Dave Geering <email@hidden>)

  • Prev by Date: Re: Changing name of newly created NSDocument (instead of 'Untitled i')
  • Next by Date: Re: Creating an NSInvocation from an NSMethodSignature
  • Previous by thread: Re: Text encoding issues
  • Next by thread: Desktop window eating clicks
  • Index(es):
    • Date
    • Thread