I can do this in Objective-C:

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

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:


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:


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


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

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



Well it looks like rawurlencode is the answer!

$note  = rawurlencode ( $note );