• 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: Malformed URL string in openURL
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Malformed URL string in openURL


  • Subject: Re: Malformed URL string in openURL
  • From: Steve Christensen <email@hidden>
  • Date: Tue, 07 Jun 2011 21:52:27 -0700

On Jun 7, 2011, at 6:32 PM, James Merkel wrote:

> On Jun 7, 2011, at 6:20 PM, Jens Alfke wrote:
>
>> On Jun 7, 2011, at 6:17 PM, James Merkel wrote:
>>
>>> The following works ok:
>>>
>>> NSString * mapquestURLString;
>>>
>>> mapquestURLString = [NSString stringWithString:@"http://mapq.st/?maptype=hybrid&q=39.7452,-104.98916";];
>>
>> (Just FYI, the -stringWithString call is redundant. You can just assign the constant directly to the variable.)
>>
>>> mapquestURLString = [NSString stringWithString:@"http://mapq.st/?maptype=hybrid&q=39.7452,-104.98916(Test point label)”];
>>
>> It’s not the parens that are illegal, it’s the spaces. Change them to   and you should be OK.
>>
>> —Jens
>
> Right you are -- thanks.
>
> I was using stringWithString because I actually  was building  up a URL string by appending strings.
> I simplified the code to show the problem.

Is there some reason you're not using built-in support to properly escape strings that are part of URLs?

NSString* mapType = @"hybrid";
NSString* location = @"39.7452,-104.98916(Test point label)";

mapquestURLString = [NSString stringWithFormat:@"http://mapq.st/?maptype=%@&q=%@";,
			[mapType stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding],
			[location stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];

_______________________________________________

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: Malformed URL string in openURL
      • From: James Merkel <email@hidden>
References: 
 >Malformed URL string in openURL (From: James Merkel <email@hidden>)
 >Re: Malformed URL string in openURL (From: Jens Alfke <email@hidden>)
 >Re: Malformed URL string in openURL (From: James Merkel <email@hidden>)
 >Re: Malformed URL string in openURL (From: Jens Alfke <email@hidden>)
 >Re: Malformed URL string in openURL (From: James Merkel <email@hidden>)

  • Prev by Date: Re: Login item not hidden
  • Next by Date: Re: Malformed URL string in openURL
  • Previous by thread: Re: Malformed URL string in openURL
  • Next by thread: Re: Malformed URL string in openURL
  • Index(es):
    • Date
    • Thread