Sanitize or treatment of string in editor via shortcode

I believe esc_url() is what you’re looking for?

here’s shortcode code:

add_shortcode('urlencode','shortcode_urlencode');
function shortcode_urlencode($atts,$content="") {
    return esc_url(do_shortcode($content));
}

not tested, but should work.