[dancer-users] UTF-8 in form POST

WK wanradt at gmail.com
Thu Jun 26 16:10:12 BST 2014


Tere!


2014-06-26 16:49 GMT+03:00 Warren Young <warren at etr-usa.com>:

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

2. Add a POST handler route to utf8form/lib/utf8form.pm:
>
>   post '/submit' => sub {
>       debug "Got '", param('field'), "' from form.";
>   };
>
>
Actually, your code uses here STDERR and seems to me, that Dancer does not
take care of it, so in your ./bin/app.pl you should add this:

  binmode(STDERR, ":encoding(UTF-8)");

But this cures only STDERR, for any other output you may have, you must
take care same or similar way. I assume, in views you see UTF-8 correctly.
At least I saw with your testcase.

-- 
Wbr,
Kõike hääd,

Gunnar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20140626/bcc61dba/attachment.html>


More information about the dancer-users mailing list