How to find out if string has already been URL encoded?

后端 未结 11 1024
死守一世寂寞
死守一世寂寞 2020-11-30 03:46

How could I check if string has already been encoded?

For example, if I encode TEST==, I get TEST%3D%3D. If I again encode last string, I

11条回答
  •  自闭症患者
    2020-11-30 04:11

    If you want to be sure that string is encoded correctly (if it needs to be encoded) - just decode and encode it once again.

    metacode:

    100%_correctly_encoded_string = encode(decode(input_string))
    

    already encoded string will remain untouched. Unencoded string will be encoded. String with only url-allowed characters will remain untouched too.

提交回复
热议问题