Is there a library that I could use in Squirrel to urlencode a string? I want to create an urlencoded string and pass it to the HTTP Post vimp (need multiple values sent to the server). For now I am doing it all manually but I'd love a way to automate things (something that receives an array and spits out the proper urlencoded string).
Thanks Hugo! I've tried that since I saw it suggested in another thread, but it didn't appear to work, I would only get a single value (a 1) as the value, not the entire array I passed as a parameter. I made sure I changed the output type to "array" instead of "string" (what's weird is that passing a string also worked when the output type was set to "number" - I guess that's a bug).
Anyway, I ended up encoding everything in JSON, like
stringtosend=@"
{
""key1"": ""value1"",
""key2"": ""value2"",
}";
(double double quotes replace regular double quotes inside the string - that's apparently how it's done in Squirrel verbatim strings)
drazvan, can you please post an example of how you did this from your code? This is pretty much what I need to do, and I’m struggling trying to figure it out.
Did you ever figure out a way to url encode a string? I know the data I’d be passing in the JSON array is url safe, because it’s my data, but I’d still like to url encode it if possible.
If you put the string into a blob it will be base64 encoded when it is delivered to you. I think if you just pass a regular string it may be encoded by the http post vimp before it is sent? (I’m not sure in that one)
I do know that if you pass native squirrel tables to the output port it will automatically be JSON encoded before it is delivered to your webserver