[Catalyst-commits] r7392 - in Catalyst-Runtime/5.70/trunk: . lib t
bricas at dev.catalyst.perl.org
bricas at dev.catalyst.perl.org
Wed Jan 16 12:36:29 GMT 2008
Author: bricas
Date: 2008-01-16 12:36:28 +0000 (Wed, 16 Jan 2008)
New Revision: 7392
Added:
Catalyst-Runtime/5.70/trunk/t/unit_core_uri_for_multibytechar.t
Modified:
Catalyst-Runtime/5.70/trunk/Changes
Catalyst-Runtime/5.70/trunk/lib/Catalyst.pm
Log:
fix uri_for()'s handling of multibyte chars (Daisuke Murase)
Modified: Catalyst-Runtime/5.70/trunk/Changes
===================================================================
--- Catalyst-Runtime/5.70/trunk/Changes 2008-01-16 12:29:16 UTC (rev 7391)
+++ Catalyst-Runtime/5.70/trunk/Changes 2008-01-16 12:36:28 UTC (rev 7392)
@@ -1,6 +1,7 @@
# This file documents the revision history for Perl extension Catalyst.
5.7012 2007-12-16 23:44:00
+ - Fix uri_for()'s handling of multibyte chars (Daisuke Murase)
- Fix __PACKAGE__->config->{foo} = 'bar' case with subclassing
- Add Catalyst::Stats (Jon Schutz)
- Fixed a bug where ?q=bar=baz is decoded as q=>'bar', not 'bar=baz'.
Modified: Catalyst-Runtime/5.70/trunk/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.70/trunk/lib/Catalyst.pm 2008-01-16 12:29:16 UTC (rev 7391)
+++ Catalyst-Runtime/5.70/trunk/lib/Catalyst.pm 2008-01-16 12:36:28 UTC (rev 7392)
@@ -978,7 +978,7 @@
$val = '' unless defined $val;
(map {
$_ = "$_";
- utf8::encode( $_ );
+ utf8::encode( $_ ) if utf8::is_utf8($_);
# using the URI::Escape pattern here so utf8 chars survive
s/([^A-Za-z0-9\-_.!~*'() ])/$URI::Escape::escapes{$1}/go;
s/ /+/g;
Added: Catalyst-Runtime/5.70/trunk/t/unit_core_uri_for_multibytechar.t
===================================================================
--- Catalyst-Runtime/5.70/trunk/t/unit_core_uri_for_multibytechar.t (rev 0)
+++ Catalyst-Runtime/5.70/trunk/t/unit_core_uri_for_multibytechar.t 2008-01-16 12:36:28 UTC (rev 7392)
@@ -0,0 +1,37 @@
+use strict;
+use warnings;
+
+use FindBin;
+use File::Spec;
+use lib File::Spec->catfile($FindBin::Bin, 'lib');
+
+use Test::More;
+
+plan tests => 3;
+
+use_ok('TestApp');
+
+my $base = 'http://127.0.0.1';
+
+my $request = Catalyst::Request->new({
+ base => URI->new($base),
+});
+
+my $context = TestApp->new({
+ request => $request,
+});
+
+
+my $uri_with_multibyte = URI->new($base);
+$uri_with_multibyte->path('/');
+$uri_with_multibyte->query_form(
+ name => '村瀬大輔',
+);
+
+
+# multibyte with utf8 bytes
+is($context->uri_for('/', { name => '村瀬大輔' }), $uri_with_multibyte, 'uri with utf8 bytes query');
+
+
+# multibyte with utf8 string
+is($context->uri_for('/', { name => "\x{6751}\x{702c}\x{5927}\x{8f14}" }), $uri_with_multibyte, 'uri with utf8 string query');
More information about the Catalyst-commits
mailing list