I utilized this script when I needed to base64 encode and then url encode a value to pass through on a url.
This repo corresponds to an article on my Medium page: P1: PII Disclosure W/ IDOR.
This script requires revisions based on the site you're working with, but this is the basic framework.