Problem with UTF8 at forward
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. ------------------------------------------------------------------ #!/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. -- Takeshi OKURA
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.
Good evening Simoes. 2011/4/10 Alberto Simoes <ambs@perl-hackers.net>:
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.
Thank you for useful information. I found a similar problem at GitHub. I update Dancer to version 1.3029_03. But my issue does not resolved. My test result( perl bin/test.pl ) is -------------------------------------------------------------------------- Subroutine main::pass redefined at bin/test.pl line 4 Prototype mismatch: sub main::pass (;$) vs none at bin/test.pl line 4 [21741] core @0.000050> initializing appdir to: `/home/okura/perl/dancer/utf8test' in /usr/local/share/perl/5.10.1/Dancer.pm l. 265 ok 1 - got expected response content for GET /direct not ok 2 - got expected response content for GET /forward # Failed test 'got expected response content for GET /forward' # at /usr/local/share/perl/5.10.1/Dancer/Test.pm line 156. (snip because of japanese multibyte character in here) # ' # doesn't match '(?-xism:\x{3042}\x{3044}\x{3046}\x{3048}\x{304a})' 1..2 # Looks like you failed 1 test of 2. -------------------------------------------------------------------------- I used Ubuntu 10.04, perl 5.10.1. -- Takeshi OKURA.
On 10/04/2011 16:02, Takeshi OKURA wrote:
Good evening Simoes.
2011/4/10 Alberto Simoes<ambs@perl-hackers.net>:
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.
Thank you for useful information. I found a similar problem at GitHub.
I update Dancer to version 1.3029_03.
But my issue does not resolved.
Yes, it is not. The fix: https://github.com/sukria/Dancer/pull/446 is not yet merged. Cheers ambs
My test result( perl bin/test.pl ) is -------------------------------------------------------------------------- Subroutine main::pass redefined at bin/test.pl line 4 Prototype mismatch: sub main::pass (;$) vs none at bin/test.pl line 4 [21741] core @0.000050> initializing appdir to: `/home/okura/perl/dancer/utf8test' in /usr/local/share/perl/5.10.1/Dancer.pm l. 265 ok 1 - got expected response content for GET /direct not ok 2 - got expected response content for GET /forward # Failed test 'got expected response content for GET /forward' # at /usr/local/share/perl/5.10.1/Dancer/Test.pm line 156. (snip because of japanese multibyte character in here) # ' # doesn't match '(?-xism:\x{3042}\x{3044}\x{3046}\x{3048}\x{304a})' 1..2 # Looks like you failed 1 test of 2. --------------------------------------------------------------------------
I used Ubuntu 10.04, perl 5.10.1.
On Sunday 10 April 2011 16:04:57 Alberto Simoes wrote:
Yes, it is not. The fix: https://github.com/sukria/Dancer/pull/446 is not yet merged.
I've just reviewed and approved this; I'll try to find a moment this afternoon to test and merge it in, and verify that it causes Takeshi's test to pass. Takeshi - thanks for your bug report, and in particular for taking the time to provide a test case illustrating how to easily reproduce the problem! Cheers Dave P -- David Precious ("bigpresh") http://www.preshweb.co.uk/ "Programming is like sex. One mistake and you have to support it for the rest of your life". (Michael Sinz)
Le 11/04/2011 12:14, David Precious a écrit :
On Sunday 10 April 2011 16:04:57 Alberto Simoes wrote:
Yes, it is not. The fix: https://github.com/sukria/Dancer/pull/446 is not yet merged.
I've just reviewed and approved this; I'll try to find a moment this afternoon to test and merge it in, and verify that it causes Takeshi's test to pass.
OK, but just a remark, don't merge it into devel, because this branch is frozen until 1.3030 is out. If you want to merge it, do it in the "reviews" branch. Thanks. -- Alexis Sukrieh
On Monday 11 April 2011 16:07:13 Alexis Sukrieh wrote:
OK, but just a remark, don't merge it into devel, because this branch is frozen until 1.3030 is out.
If you want to merge it, do it in the "reviews" branch.
Indeed, I saw the mail about that :) -- David Precious ("bigpresh") http://www.preshweb.co.uk/ "Programming is like sex. One mistake and you have to support it for the rest of your life". (Michael Sinz)
participants (4)
-
Alberto Simoes -
Alexis Sukrieh -
David Precious -
Takeshi OKURA