• 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
URL Encoding
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

URL Encoding


  • Subject: URL Encoding
  • From: "Mike Chambers" <email@hidden>
  • Date: Wed, 31 Oct 2007 15:07:08 -0700

I am trying to figure out how to properly URL Encode Urls in Objective-C
Cocoa.
I know this has been discussed before, and doing a quick search, I came
across:

CFURLCreateStringByAddingPercentEscapes

with an example from here:

http://www.cocoabuilder.com/archive/message/cocoa/2001/12/16/16098

+(NSString *) urlencode: (NSString *) url

{


 NSString* out = [(NSString*)

CFURLCreateStringByAddingPercentEscapes(NULL,

(CFStringRef) url,

 NULL,

NULL, kCFStringEncodingUTF8)

autorelease];

 return out;

}


I have tried multiple examples of this, but it does not encode my URLs.

I ended up writing my own method to do this (which works):

http://mesh.typepad.com/blog/2007/10/url-encoding-wi.html#more

but I have this sneaking suspicion there is a better way.

So, how should I url encode urls within Cocoa?

thanks for any input / insight...

mike chambers
_______________________________________________

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: URL Encoding
      • From: Jim Puls <email@hidden>
    • Re: URL Encoding
      • From: Nick Zitzmann <email@hidden>
  • Prev by Date: Re: Missing Mouse Events in PDFView
  • Next by Date: Re: Create NSImage from array of integers
  • Previous by thread: Re: Create NSImage from array of integers
  • Next by thread: Re: URL Encoding
  • Index(es):
    • Date
    • Thread