I'm getting data corruption when a UTF-8 encoded web page sends form data back to Dancer via POST.

As far as I can tell, the browser is doing the right thing and submitting the data as UTF-8 -- verified with Firebug -- but when I try to retrieve the data with param(), Dancer treats it as something else.

To see this, say "dancer -a utf8form" and edit two of the files:

1. Replace the contents of utf8form/views/index.tt with:

  <form method="post" action="/submit">
    <input name="field" type="text"/>
  </form>

2. Add a POST handler route to utf8form/lib/utf8form.pm:

  post '/submit' => sub {
      debug "Got '", param('field'), "' from form.";
  };

Since my terminal uses UTF-8 and default Dancer apps have UTF-8 in config.yml and the generated HTML templates, the debug() call shouldn't need any special help, IMO.

Try submitting "EspaƱol", for example.
_______________________________________________
dancer-users mailing list
[email protected]
http://lists.preshweb.co.uk/mailman/listinfo/dancer-users

Reply via email to