• 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 file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Text file


  • Subject: Re: Text file
  • From: Jens Alfke <email@hidden>
  • Date: Sun, 18 Apr 2010 12:41:28 -0700

On Apr 18, 2010, at 12:40 AM, Henrietta Read wrote:

> exactly the point germane, but in perusing NSString.h one is given to understand this method might not be as 'smart' as one could wish:

I wouldn’t think it would fail with MacRoman, though. Did you check the output NSError? Also, try inspecting the file with a hex editor … maybe there are some invisible null bytes or control characters.

What I usually do in cases like this, when trying to decode arbitrary data to strings, is to fall back to assuming NSWindowsCP1252StringEncoding. This is (a) a very common encoding [the default on most Windows systems], (b) fairly standard (it’s a superset of ISO-Latin-1), and (c) always works since it encodes all 256 bytes values.

—Jens_______________________________________________

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

  • Follow-Ups:
    • Re: Text file
      • From: Henrietta Read <email@hidden>
References: 
 >Text file (From: Henrietta Read <email@hidden>)
 >Re: Text file (From: Jens Alfke <email@hidden>)
 >Re: Text file (From: Henrietta Read <email@hidden>)

  • Prev by Date: [Moderator] Re: +Hi+
  • Next by Date: Warning with an initializer method of AMWorkflow
  • Previous by thread: Re: Text file
  • Next by thread: Re: Text file
  • Index(es):
    • Date
    • Thread