Hello again,
Recently, I've been toying around with forms in UFront. I made a simple app with a form that lets the user submit a string by POST request. The route handling the request returns a
RedirectResult, passing the submitted string to another route. The receiving route then returns the string in a
ViewResult. For example:
@:route("/$name", GET)
public function index(?name : String = "stranger")
{
return new ViewResult({
greeting: 'Hello, $name.',
});
}
@:route("/action/submit/", POST)
public function submit(args : {name : String})
{
return new RedirectResult(Config.app.basePath + args.name); }
Submitting unreserved URI characters works as expected. UTF-8 characters (such as č, ć, ž, đ, š), on the other hand, get percent-encoded and printed as such by the GET request. However, when I directly return the submitted form arguments in the /action/submit/ route, I get the non-percent-encoded string, as expected.
I set my layout's character encoding, as well as the form's accepted charset, to UTF-8. The resulting web app prints UTF-8 characters just fine, but the ones received in during the GET request get percent-encoded.
Is it possible to "control" the percent-encoding of submitted characters? Or is there, perhaps, a method to decode the GET request data? I had no luck solving this so far, so I'm looking for a clue as to how to get this done.
Thank you in advance for any help you can provide,
Domagoj