How do I percent encode a JSON string on my clipboard?

There's a discussion at:

https://developer.apple.com/library/mac/documentation/CoreFoundation/Reference/CFURLRef/index.html#//apple_ref/c/func/CFURLCreateStringByAddingPercentEscapes

It may be difficult to use this function to "clean up" unescaped or partially escaped URL strings where sequences are unpredictable and you cannot specify charactersToLeaveUnescaped. Instead, you can "pre-process" a URL string using CFURLCreateStringByReplacingPercentEscapesUsingEncoding then add the escape characters using CFURLCreateStringByAddingPercentEscapes

It doesn't actually look as if anything is broken to me, and I think it's producing the same output as:

i.e. only encoding enough to make a simply-formed URI compliant.

But perhaps there is an argument for providing an additional sister function which doesn't protect protocol substrings etc, and may possibly be closer to what users expect, in some contexts.

Analogous, in other words to:

?

( First draft of a custom action at Filter system clipboard to percent-encode a URI component )

(And a set of 4 actions simply wrapping the 4 (encode/unencode) * (uri/uriComponent) JavaScript functions, and allowing for input from variables, text, tokens etc as well as from the clipboard, at: