Forms - shmolyneaux/SquareJam GitHub Wiki

Data from HTML forms sent to SnakeCharmer can be accessed from req.form.

When a form is submitted using a GET request, certain characters are encoded. An example of this can be seen if @#$%^& is searched using Google. Compare @#$%^&:

https://www.google.ca/search?q=%40%23%24%25%5E%26

and apdpha test

https://www.google.ca/search?q=apdpha+test

, is encoded as %2C, and spaces as %20 or + as another example. They can be decoded in python using using unquote_plus from the urllib.parse library.

from urllib.parse import unquote_plus;

raw_data = req.form['name'];
unescpaed_data = unquote_plus(req.form['text']);

if 'date' in req.form.keys():
  print(unquote_plus(req.form['date']));