• 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: How can I make NSString.stringEncodingForData fail?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How can I make NSString.stringEncodingForData fail?


  • Subject: Re: How can I make NSString.stringEncodingForData fail?
  • From: Daryle Walker <email@hidden>
  • Date: Thu, 02 Jun 2016 19:13:32 -0400

I worked around this by making the encodings list a method argument, defaulted to the values mentioned. Then I could test by running the method with an encoding that I know will fail.

Sent from my iPhone

> On May 29, 2016, at 3:23 AM, Daryle Walker <email@hidden> wrote:
>
> I'm about to test code that uses this method. My encodings are: ASCII, UTF-8, ISO Latin-1, then MacRoman. I think this covers all potential octet values. My "guard" blocks (I'm using Swift.) are for a 0 return and if the optional returned NSString can't be converted to a String.
>
> Can I cause some fail cases, or is that so unlikely that I should assert on non-zero return and use "!" on the optional?
>
> Sent from my iPhone
> _______________________________________________
>
> 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


  • Prev by Date: Re: On getting the wrong file type
  • Next by Date: Re: When can String.enumerateSubstringsInRange ever pass in NIL?
  • Previous by thread: Re: On getting the wrong file type
  • Next by thread: Re: When can String.enumerateSubstringsInRange ever pass in NIL?
  • Index(es):
    • Date
    • Thread