• 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
NSURL String formatting
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSURL String formatting


  • Subject: NSURL String formatting
  • From: Jason McInnes <email@hidden>
  • Date: Wed, 12 Nov 2003 22:53:47 -0800 (PST)

OK, I'm being really dense and I'm sure the solution
is easy.

I've constructed an NSString which is a non-escaped
URL:

http://www.usps.com:80/zip4/zip4_response.jsp?zipcode=98177&Selection=1&address=567
Main Street Suite 100&address1=567 Main
Street&address2=Suite
100&city=Shoreline&state=WA&urbanization=&firm=

I make the following function call:
escapedString = (NSString
*)CFURLCreateStringByAddingPercentEscapes(NULL,
(CFStringRef)urlString, NULL, NULL,
kCFStringEncodingUTF8);

(I autorelease escapedString latter...)

When I NSLog escapedString, however, I get this:
http://www.usps.com:80/zip4/zip4_response.jsp?zipcode=98177&Selection=1&address=5672ain

\\u7400\\u34fe\\ud0bf\\uffe9\\u6c97\\ue382\\uf8bf\\uffe9treet(null)uite2address1=5672ain(null)treet&address2=Suite2city=Shoreline&state=WA&urbanization=&firm=

Perhaps not unexpectedly, when I connect to the
server, I get an error:
<HTML><HEAD><TITLE>Bad request</TITLE></HEAD>
<BODY><H1>Bad request</H1>
Your browser sent a query this server could not
understand.
</BODY></HTML>

I'm sure I'm doing something fundamentally wrong since
my code is as simple as simple can be. What am I missing?

=====
Jason McInnes
2 Degrees
Cell: 206.849.3680
Email: email@hidden

__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree
_______________________________________________
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: NSURL String formatting
      • From: Nick Zitzmann <email@hidden>
  • Prev by Date: Re: Cocoa daemon
  • Next by Date: Re: current mouse buttons state
  • Previous by thread: Re: Launch crash in strstr... what gives?
  • Next by thread: Re: NSURL String formatting
  • Index(es):
    • Date
    • Thread