[Dancer-users] Problem with UTF8 at forward

Takeshi OKURA okura3 at gmail.com
Wed Apr 13 16:10:53 CEST 2011


2011/4/13 ambs <ambs+dancer at perl-hackers.net>:
> git checkout PR/expose_433

Thank you ambs.
I did it. And when seeing in a web browser, /direct and /forward looks same.
I am Happy.

But my previous test still fail and little more changed test case below is pass.
------------------------------------------------------------------------------------
use strict;
use Test::More;
use Dancer;
use Dancer::Test;
use Encode qw/encode_utf8/;
use utf8;

my $utf8_str = "\x{3042}\x{3044}\x{3046}\x{3048}\x{304a}";
my $utf8_byte = encode_utf8( $utf8_str );

get '/direct' => sub {
  my $notes = $utf8_str;
  return template 'index',{notes => $notes},{layout=>undef};
};

get '/forward' => sub {
  return forward '/direct';
};

response_content_like [GET => '/direct'],
  qr/\Q$utf8_str\E/,
  "got expected response content for GET /direct";

response_content_like [GET => '/forward'],
  qr/\Q$utf8_byte\E/,
  "got expected response content for GET /forward";

done_testing;
------------------------------------------------------------------------------------

it is seems to be 'forward'  returns utf8 encoded byte stream,

-- 
Takeshi OKURA


More information about the Dancer-users mailing list