On Fri, Jul 23, 2010 at 11:54 AM, Joe Turner <joetur...@me.com> wrote:
> 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.

The process you are referring to is called x-www-form-urlencoding,
which is a combination of replacing spaces with + signs and
percent-escaping. You should do this as you're building your POST
data. All of this needs to be done in the character set you're
submitting the POST in, which is ISO-8859-1 by default, unless you
explicitly override it with a charset in the Content-Type header.

If I were working on this problem, I would imagine an API which I
could hand a dictionary of string->string pairs and get back a
properly form-encoded NSData object. I would enumerate each key-value
pair, converting its key and value to the appropriate character set
(ISO-8859-1) and then performing sanitization. Once I've completed
that, I would glue them all together with the appropriate & and =
characters.

--Kyle Sluder
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to