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

  • SEARCH
  • Home
  • 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 8640329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:15:12+00:00 2026-06-12T11:15:12+00:00

I have this very simple code: PO(URLString); url = [NSURL URLWithString:URLString]; PO(url); NSData *

  • 0

I have this very simple code:

PO(URLString);
url = [NSURL URLWithString:URLString];
PO(url);
NSData * data=[NSData dataWithContentsOfURL:url];

(PO() is my macro to print stuff.)

It works most of the time. Here is the output:

2012-10-08 11:39:28.187 BadgerNew[2475:5007] <0x1f5321f0
BGCRBusinessForDisplay.m:(113)> URLString:
http://id.openrice.com/UserPhoto/photo/0/U/0005Z29E131A230CBA4A42n.jpg

2012-10-08 11:39:28.193 BadgerNew[2475:5007] <0x1f5321f0
BGCRBusinessForDisplay.m:(115)> url:
http://id.openrice.com/UserPhoto/photo/0/U/0005Z29E131A230CBA4A42n.jpg

2012-10-08 11:39:30.191 BadgerNew[2475:6b03] <0x1f529f00
BGCRBusinessForDisplay.m:(113)> URLString:
http://maps.googleapis.com/maps/api/staticmap?&zoom=16&size=160x160&maptype=roadmap&sensor=true&center=-6.187900,106.775429&markers=size:small|color:blue|-6.187900,106.775429

2012-10-08 11:39:30.196 BadgerNew[2475:6b03] <0x1f529f00
BGCRBusinessForDisplay.m:(115)> url: (null)

As you see, it works fine for http://id.openrice.com/UserPhoto/photo/0/U/0005Z29E131A230CBA4A42n.jpg and it fails on http://maps.googleapis.com/maps/api/staticmap?&zoom=16&size=160×160&maptype=roadmap&sensor=true&center=-6.187900,106.775429&markers=size:small|color:blue|-6.187900,106.775429

Perhaps the issue is the | in the Google URL. So what should I do with it?

  • 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-06-12T11:15:13+00:00Added an answer on June 12, 2026 at 11:15 am

    You’re right, the | (the “pipe”) is the problem.

    The Apple docs for URLWithString: say that the relevant external docs are RFCs 2396 and 1738. According to them, | is an “unsafe” character and must always be encoded in a URL. The encoding for it is %7C.

    You can correct the pipes in your string manually (if it is a hard-coded string), but the better solution would be to replace them and any other problematic characters using -[NSString stringByAddingPercentEscapesUsingEncoding:].

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

Sidebar

Related Questions

I have this very simple python code to read xml for the wikipedia api:
I'm stuck! I have this very simple test code and I can't get it
I have this code for a table which is very simple: <table cellspacing=10 cellpadding=10>
I use ikvm with mpxj project. I have a very simple code like this....
I have this code: It's very simple. I create an interval, and that works
I have this very simple code or at least i think it's simple. //
I have this very simple (yet big) code that doesn't work. The triangle doesn't
I have this very simple code to check if a site is up or
I have a problem with this very simple block of code. please give me
I have this very simple test code: s=helloCustomer is_contain_customer = s=='helloCustomer' || s.include? 'Customer'

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.