[Dancer-users] Problem with UTF8 at forward

Alberto Simoes ambs at perl-hackers.net
Sun Apr 10 16:06:30 CEST 2011


On 10/04/2011 09:24, Takeshi OKURA wrote:
> I like Dancer. and i like to use dancer in my webapp.
> But I got a problem with utf8 character. I can't solve the problem myself.
>
>   simple use of utf8 is ok. but Problem got at forward route.
>
> My test code is below. First test is pass. But second test is fail.
> Dancer version is 1.3020.

I think this problem is already solved in Git (if not, there is a pull 
request for that already). So, please try updating your Dancer version 
to github devel head.

Cheers

> ------------------------------------------------------------------
> #!/usr/bin/perl
> use strict;
> use Test::More;
> use Dancer;
> use Dancer::Test;
> use utf8;
>
> get '/direct' =>  sub {
>    my $notes = "\x{3042}\x{3044}\x{3046}\x{3048}\x{304a}";
>    return template 'index',{notes =>  $notes},{layout=>undef};
> };
>
> get '/forward' =>  sub {
>    return forward '/direct';
> };
>
> response_content_like [GET =>  '/direct'],
>    qr/\x{3042}\x{3044}\x{3046}\x{3048}\x{304a}/,
>    "got expected response content for GET /direct";
>
> response_content_like [GET =>  '/forward'],
>    qr/\x{3042}\x{3044}\x{3046}\x{3048}\x{304a}/,
>    "got expected response content for GET /forward";
>
> done_testing;
> ---------------------------------------------------------------------------------
>
> index.tt is '<div id="page">  notes:<% notes %>  </div>'.
>
> config.yml is below.
>
> appname: "utf8test"
> layout: "main"
> charset: "UTF-8"
> template: "simple"
>
> Please advice to me.



More information about the Dancer-users mailing list