Re: How can I make NSString.stringEncodingForData fail?
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