Re: Tidying NSURLs Containing XML
Re: Tidying NSURLs Containing XML
- Subject: Re: Tidying NSURLs Containing XML
- From: Mike <email@hidden>
- Date: Mon, 11 Aug 2008 22:45:17 -0700
That's sort of what I was asking, except I need the reverse - not
removing escape chars and replacing them with "real" equivalents - I
need to remove single real characters that are invalid in URLs and
replace them with the equivalent escapes.
For example, the equivalent escape character for " " is " ". NSURL
likes the later, but fails on the former if there's a real space in the URL.
I think what I want is -stringByAddingPercentEscapesUsingEncoding:
Thanks,
Mike
Ken Ferry wrote:
Hi Mike,
I'm not totally sure what you're asking, but you may want to look in
the documentation for -[NSString
stringByAddingPercentEscapesUsingEncoding:].
"Returns a representation of the receiver using a given encoding to
determine the percent escapes necessary to convert the receiver into a
legal URL string."
-Ken
On Mon, Aug 11, 2008 at 7:21 PM, Mike <email@hidden> wrote:
Is there a way to scan an entire XML doucment and NSURL to make sure it
contains only valid characters?
I am thinking of the case of web services apps where large chunks of XML
data get appended to the end of the URL before it is sent to the server.
Spaces for example don't conform to RFC 1808 and so the NSURL create
functions fail if one tries to create a URL with XML containing spaces at
the end.
It would be nice to have a way to scan a long URL like that and
alert/replace when any illegal characters are found in it.
Thanks,
Mike
_______________________________________________
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