How to know if a URL is decoded/encoded?

后端 未结 5 798
后悔当初
后悔当初 2021-02-05 04:37

I am using Javascript method decodeURIComponent to decode an encoded URL. Now I am having an issue, that sometimes the URL is get encoded twice during redirection b

5条回答
  •  借酒劲吻你
    2021-02-05 05:20

    you can keep decode until the string did not change:

    str = "xxxxxxx"
    dec_str = decode(str)
    while(dec_str != str)
         str = dec_str;
         dec_str = decode(str);
    

提交回复
热议问题