javascript - encodeURI doesn't escape `equals` - why? -
i have uri that:
http://client.dev/dap/module/hdfs-web/api/v1.0/clusters/cluster%201%20-%20cdh4?operation=copy&to=/user/hdfs/year=2016/partial.txt&overwrite=true
i use encodeuri
function escape string. i'm wondering why spaces encoded %20
while equals
characters not?
encodeuri
encodes full uri, , uris can contain =
characters. instance, if user types in uri, first step resolve call encodeuri
on it.
if on other hand 1 constructing uri, , input determines 1 field (for instance search query, when given e=mc²
want resolve https://www.google.com/search?q=e%3dmc%c2%b2
), not encoding full uri, uri component. use encodeuricomponent
that:
> encodeuricomponent('= ') '%3d%20'
Comments
Post a Comment