1
0
Fork 0
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
289 B

#!/usr/bin/env python3
# Brutal URL encoding of whatever string is passed as argument.
import binascii
import sys
s = sys.argv[1].encode()
h = binascii.hexlify(s).decode()
encoded = ""
for i in range(len(h) // 2):
byte = h[i * 2 : i * 2 + 2]
encoded += "%" + byte
print(encoded)