percent_encode
replaces characters that don't fit URLs by their hexadecimal code preceded by %
. It does that for all characters that are not in the following ranges:
A
..Z
, a
..z
, 0
..9
, -
, _
, ~
, and .
.
So yes, according to the doc, it was meant to encore URL strings, especially for parameters or forms.