I can do this in Objective-C:

newNotewUTF8 = (NSString *)CFURLCreateStringByAddingPercentEscapes(NULL,																				(CFStringRef)oldNote,																				NULL,																				(CFStringRef)@"!*'\"();:@&=+$,/?%#[]% ",																				kCFStringEncodingUTF8 );

Ex:
oldNote looks like this: This is a note
newNotewUTF8 comes out like this: This%20is%20a%20note

And it works out fine. I can receive the above Note in a url:

"http://www.siteurl.com/input.php?note=This%20is%20a%20note"

in my PHP script and echo it back out to the screen.

Note looks like this: This is a note

However, I need to take the php $note and use it to create a new URL. The new URL needs to be properly formatted. I need to get $note back to:

"http://www.newurl.com/something?note=This%20is%20a%20note"

How can I do the above Objective-C in PHP?

Thanks
-Kevin

Okay, I may have asked for the wrong thing. ??

How can I convert: This is a note
To: This%20is%20a%20note

??

Thanks
-Kevin

Well it looks like rawurlencode is the answer!

$note  = rawurlencode ( $note );
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.