• 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: NSStrings for NSURL URLWithString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSStrings for NSURL URLWithString


  • Subject: Re: NSStrings for NSURL URLWithString
  • From: "Louis C. Sacha" <email@hidden>
  • Date: Tue, 4 May 2004 18:31:02 -0700

Hello...

If you are targeting 10.3 or later, you can use the NSString instance method

- (NSString *)stringByAddingPercentEscapesUsingEncoding:(NSStringEncoding)encoding;

Otherwise, you would need to use the CoreFoundation CFURL function CFURLCreateStringByAddingPercentEscapes(...) which should always be available, although you will have to be careful to release the result (CF functions with Create in the name follow the same memory management rules as the objC methods alloc and copy).

For the string encoding needed as an argument for these, you would probably use NSUTF8StringEncoding.

Hope that helps,

Louis

Hi, I did some searching, but no luck. I have an NSString that I want to use in [NSURL URLWithString:], the problem is, my string contains the carrot character ("^") which NSURL doesn't like, as stated in the documentation. Problem is, I don't know how or what I need to do convert the ^ character to. Can someone help.

Thanks,
Ian _______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: NSStrings for NSURL URLWithString
      • From: "Ian G. Gillespie" <email@hidden>
References: 
 >NSStrings for NSURL URLWithString (From: "Ian G. Gillespie" <email@hidden>)

  • Prev by Date: The position of the insertion point in an NSTextView?
  • Next by Date: Re: NSStrings for NSURL URLWithString
  • Previous by thread: NSStrings for NSURL URLWithString
  • Next by thread: Re: NSStrings for NSURL URLWithString
  • Index(es):
    • Date
    • Thread