• 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: Does NSString's "- initWithContentsOfURL:usedEncoding:error:" use the tightest encoding possible?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Does NSString's "- initWithContentsOfURL:usedEncoding:error:" use the tightest encoding possible?


  • Subject: Re: Does NSString's "- initWithContentsOfURL:usedEncoding:error:" use the tightest encoding possible?
  • From: Charles Srstka <email@hidden>
  • Date: Sun, 17 Apr 2016 13:05:49 -0500

> On Apr 17, 2016, at 1:19 AM, Jens Alfke <email@hidden> wrote:
>
>>
>> On Apr 16, 2016, at 7:35 PM, Daryle Walker <email@hidden <mailto:email@hidden>> wrote:
>>
>> If the given method is used to read in a pure ASCII file, will the encoding be set to ASCII?  Or could the method return a superset encoding (like Latin-1, MacRoman, or UTF-8)?
>
> I don’t know; you could try it out, of course, but it sounds like the sort of undefined behavior you shouldn’t rely on.
>
> If you’re trying to determine if the string is pure ASCII, you can use -rangeOfCharactersInSet: to look for anything above 127.

Or -canBeConvertedToEncoding:.

Charles

_______________________________________________

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: 
 >Does NSString's "- initWithContentsOfURL:usedEncoding:error:" use the tightest encoding possible? (From: Daryle Walker <email@hidden>)
 >Re: Does NSString's "- initWithContentsOfURL:usedEncoding:error:" use the tightest encoding possible? (From: Jens Alfke <email@hidden>)

  • Prev by Date: Window Resizing
  • Next by Date: Getting a double-click on a text label
  • Previous by thread: Re: Does NSString's "- initWithContentsOfURL:usedEncoding:error:" use the tightest encoding possible?
  • Next by thread: How to comply to Disability Discrimination Act of 1995 while developing an iOS app
  • Index(es):
    • Date
    • Thread