• 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: NSPropertyListSerialization and string encoding
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSPropertyListSerialization and string encoding


  • Subject: Re: NSPropertyListSerialization and string encoding
  • From: Joe Turner <email@hidden>
  • Date: Fri, 23 Jul 2010 13:54:19 -0500

However, now it seems my issue is with &'s in the data itself from the property list. If the plist contained an "&" somewhere, everything after that point is cut off (which makes sense). Is there any way around this? It seems I have to percent escape the data before posting, which (the only way I know how to do), has to be done with NSStrings.

Joe
On Jul 23, 2010, at 11:50 AM, Kyle Sluder wrote:

> On Fri, Jul 23, 2010 at 9:34 AM, Joe Turner <email@hidden> wrote:
>> Hey,
>>
>> No one is requiring me to send a string–I do indeed send it as data, but I must convert values from string to data. Like, I have a title field, in which I must convert the title to NSData. But since there are a bunch of arguments like this, I just make a string like @"arg1=something&arg2=something...", and then do [dataUsingEncoding:allowLossyConversion:.
>>
>> Should I be doing this a better way? (I'm the one who created the web service, so if there's an issue with doing it this way, I can easily change it).
>
> Yes. The better way is not to use NSString, since strings are a
> conceptually different beast from data. You might start out with a
> string (say, the user types something into a text field), but you want
> to convert that to data at some point before tacking it on to the rest
> of the data that comprises your POST request. Don't conflate the two,
> which you're doing by trying to build a string that contains your
> urlencoded POST data. Convert the strings to data *first*, then
> compile all your data into a POST request.
>
> --Kyle Sluder

_______________________________________________

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: NSPropertyListSerialization and string encoding
      • From: Kyle Sluder <email@hidden>
References: 
 >NSPropertyListSerialization and string encoding (From: Joe Turner <email@hidden>)
 >Re: NSPropertyListSerialization and string encoding (From: Kyle Sluder <email@hidden>)
 >Re: NSPropertyListSerialization and string encoding (From: Joe Turner <email@hidden>)
 >Re: NSPropertyListSerialization and string encoding (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: NSBox with a NSPopUpButton
  • Next by Date: Re: NSPropertyListSerialization and string encoding
  • Previous by thread: Re: NSPropertyListSerialization and string encoding
  • Next by thread: Re: NSPropertyListSerialization and string encoding
  • Index(es):
    • Date
    • Thread