I'm writing a component that integrate between two 3rd-party libraries.
Gets a URL from the first library, and pass it to the second library.
The URL i get is in the format of:
meaning it include signs like "=" and "+" in encoded format.
When I pass it to the second library as-is, the library failed to download the file. From the source of that library I see that it tries to perform 'encode(url)' before downloading the file, which cause it to be encoded again with no need.
I tried decoding the URL before transferring it to the second library (with decodeURI or decodeURIComponent), so it will then encode it and successfully download the file, but encode() doesn't encode all chars, it has some reserved-char (like '+' and '='), so the result url wasn't end up the same as the original.
To sum-up my question:
Assuming i don't have any control over the code of the 2 libraries, given 'encodedUrl', how can I implement 'myFunc(str)' such that:
encodeURI(myFunc(encodedUrl)) === encodedUrl
for every url possible.