Changed encoding of strings to conform to point 5 of w3 spec:

http://www.w3.org/TR/html5/forms.html#url-encoded-form-data

encodeString method was adapted from ruby escape method:

 http://www.ruby-doc.org/stdlib-1.9.3/libdoc/cgi/rdoc/CGI.html#method-c-escape