Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6891807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:27:23+00:00 2026-05-27T06:27:23+00:00

NSURL does not support the use of curly braces (i.e. {}) in URLs. My

  • 0

NSURL does not support the use of curly braces (i.e. {}) in URLs. My application needs to talk to a server that requires the use of curly braces in the URL. I’m considering using bridges to write the networking code in Python or C++, or even rewriting the C code for NSURL to make it accept curly braces. Percent escapes are not accepted by my remote server.

Do I have any other good alternatives?

EDIT: Explained why addingPercentEscapesUsingEncoding and the like don’t work for me here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T06:27:24+00:00Added an answer on May 27, 2026 at 6:27 am

    Will it work for you if you escape the braces?

    This code:

    // escape {} with %7B and %7D
    NSURL *url = [NSURL URLWithString:@"http://somesite.com/%7B7B643FB915-845C-4A76-A071-677D62157FE07D%7D.htm"];
    NSLog(@"%@", url);
    
    // {} don't work and return null
    NSURL *badurl = [NSURL URLWithString:@"http://somesite.com/{7B643FB915-845C-4A76-A071-677D62157FE07D}.htm"];
    NSLog(@"%@", badurl);
    

    Outputs:

    2011-11-30 21:25:06.655 Craplet[48922:707] http://somesite.com/%7B7B643FB915-845C-4A76-A071-677D62157FE07D%7D.htm
    2011-11-30 21:25:06.665 Craplet[48922:707] (null)
    

    So, escaping seems to work

    Here’s how you can programmatically escape the url:

    NSString *escapedUrlString = [unescaped stringByAddingPercentEscapesUsingEncoding: NSASCIIStringEncoding];
    

    EDIT:

    In your comment below, you said your server won’t accept encoded braces and was there any other alternatives. First, I would try and get the server fixed. If that’s not possible … I haven’t tried this with braces etc… but the layer below NS networking classes is CFNetworking.

    See this:

    http://developer.apple.com/library/ios/#documentation/Networking/Conceptual/CFNetwork/CFHTTPTasks/CFHTTPTasks.html#//apple_ref/doc/uid/TP30001132-CH5-SW2

    From that doc:

     CFStringRef url = CFSTR("http://www.apple.com");
     CFURLRef myURL = CFURLCreateWithString(kCFAllocatorDefault, url, NULL);
     CFStringRef requestMethod = CFSTR("GET");
    
     ....
    

    Once again, haven’t tried it and I’m running out. might try it later but if a layer isn’t working your first options are to move down the stack.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I used MPMoviePlayerController in my application. I got the right URL but MPMoviePlayer does
I try some like that: NSString *url = @http://www.example.com; NSURL *urlRequest = [NSURL URLWithString:url];
The application:applicationDidFinishLaunchingWithOptions: message does not get called when an application is sitting in the
I am attempting to download a URL using NSURLDownload, but it does not start
I am calling a Singleton method that does not get called when I try
Why, when an image does not exist at a specified URL, does didFailWithError not
I have an NSURL which contains a URL and a variable that is an
So I have the following code: NSURL *baseURL = [NSURL URLWithString:@http://www.baseurltoanxmlpage.com]; NSURL *url =
I'm tring to use the NSURL class's parameterString message to return the string from
I'm searching Twitter for tweets with this code: - (void)fetchTweets { NSURL *url =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.