1

I'm trying to do it in VBScript/JScript, to avoid re-encoding.
Should I judge if there is "%" ? Does "%" have other uses in URL?
Thanks.

Edit: Oh, the original encoding function may not be encodeURI.
I'm trying to collect URLs from the browser, and store them after encoding with encodeURI.
But if the URL is already encoded, another encoding will make it wrong.

4

2 回答 2

1

I might try decoding it and comparing the result to the original URL. If it changed or got shorter in length your original URL was probably already encoded.

于 2010-07-04T17:07:07.960 回答
0

iterate over the chars in the url and test for characters that aren't allowed in an url.

if there are any encode it. if there aren't any illegal characters, it doesn't matter

于 2010-07-04T17:09:16.343 回答