encodeURICompnent() is not intended for paths to access your POST file.
The function is intended for use with ONLY the query string.
Example:Suppose you have a POST like this:
../php/mywidget.php?path=../php&var1=23&var2=Hello my name is John
In the case above the query string is all of the stuff following the "?" and in order for it to send correctly to a web server special characters must be encoded. Once encoded, the above query would look like this and be safe for upload to a web server:
../php/mywidget.php?path%3D..%2Fphp%26var1%3D23%26var2%3DHello%20my%20name%20is%20John
Here are the actions I used to build this example:Suppose we set up two fields; one is named
"query"—which contains the raw POST—and one that is named
"encodedQuery"—which will display the result of encoding the query portion of the string.
On click ...
Execute Script pgSplitToArray( text of field "query", "?" ); store return value in tmp;
Execute Script encodeURIComponent( tmp [1] ); store return value in tmp [1];
Set text of field "encodedQuery" to tmp [0] & "?" & tmp [1]
end click
Clicking a button will split the POST into the path to file AND query string; then it will encode the query portion; and finally reassemble the POST into a web-friendly result for use with
XMLHttpRequest().