The Python code is:
user = "aabc"
password = "yyy12%"
data = urllib.urlencode({"loginname": user, "nloginpwd": password})
print data
The result is: loginname=aabc&nloginpwd=yyy12%25
Why was 25
added to the end of the string?
The Python code is:
user = "aabc"
password = "yyy12%"
data = urllib.urlencode({"loginname": user, "nloginpwd": password})
print data
The result is: loginname=aabc&nloginpwd=yyy12%25
Why was 25
added to the end of the string?
The %
character has special meaning in a URL; it is used to start an escape sequence. See the Percent-encoding article on Wikipedia. A literal %
then has to be encoded too, and %25
is the encoded version. From the Wikipedia page:
Because the percent (
"%"
) character serves as the indicator for percent-encoded octets, it must be percent-encoded as"%25"
for that octet to be used as data within a URI.
In other words, the %25
is an encoded %
character.