[Catalyst-commits] r13022 - in
Catalyst-Plugin-Unicode-Encoding/trunk: .
lib/Catalyst/Plugin/Unicode t
t0m at dev.catalyst.perl.org
t0m at dev.catalyst.perl.org
Sun Mar 7 22:39:27 GMT 2010
Author: t0m
Date: 2010-03-07 22:39:27 +0000 (Sun, 07 Mar 2010)
New Revision: 13022
Modified:
Catalyst-Plugin-Unicode-Encoding/trunk/Changes
Catalyst-Plugin-Unicode-Encoding/trunk/README
Catalyst-Plugin-Unicode-Encoding/trunk/lib/Catalyst/Plugin/Unicode/Encoding.pm
Catalyst-Plugin-Unicode-Encoding/trunk/t/06request_decode.t
Log:
And fix request arguments
Modified: Catalyst-Plugin-Unicode-Encoding/trunk/Changes
===================================================================
--- Catalyst-Plugin-Unicode-Encoding/trunk/Changes 2010-03-07 21:06:13 UTC (rev 13021)
+++ Catalyst-Plugin-Unicode-Encoding/trunk/Changes 2010-03-07 22:39:27 UTC (rev 13022)
@@ -1,5 +1,9 @@
Revision history for Perl extension Catalyst::Plugin::Unicode::Encoding
+ - Correctly decode UTF-8 URI Encoded (as per RFC3986) into
+ $c->request->arguments
+ - Test for this (u-foka)
+
0.8 2010-01-11 13:36:16
- Don't fail tests if we have an old version of URI::Escape
installed.
Modified: Catalyst-Plugin-Unicode-Encoding/trunk/README
===================================================================
--- Catalyst-Plugin-Unicode-Encoding/trunk/README 2010-03-07 21:06:13 UTC (rev 13021)
+++ Catalyst-Plugin-Unicode-Encoding/trunk/README 2010-03-07 22:39:27 UTC (rev 13022)
@@ -12,7 +12,7 @@
METHODS
encoding
- Returns a instance of a "Encode" encoding
+ Returns an instance of an "Encode" encoding
print $c->encoding->name
Modified: Catalyst-Plugin-Unicode-Encoding/trunk/lib/Catalyst/Plugin/Unicode/Encoding.pm
===================================================================
--- Catalyst-Plugin-Unicode-Encoding/trunk/lib/Catalyst/Plugin/Unicode/Encoding.pm 2010-03-07 21:06:13 UTC (rev 13021)
+++ Catalyst-Plugin-Unicode-Encoding/trunk/lib/Catalyst/Plugin/Unicode/Encoding.pm 2010-03-07 22:39:27 UTC (rev 13022)
@@ -103,6 +103,20 @@
}
}
+sub prepare_action {
+ my $c = shift;
+
+ my $ret = $c->next::method(@_);
+
+ my $enc = $c->encoding;
+
+ foreach (@{$c->req->arguments}) {
+ $_ = Encode::is_utf8( $_ ) ? $_ : $enc->decode( $_, $CHECK );
+ }
+
+ return $ret;
+}
+
sub setup {
my $self = shift;
@@ -160,6 +174,10 @@
Decodes parameters, query_parameters, body_parameters and filenames
in file uploads into a sequence of logical characters.
+=item prepare_action
+
+Decodes request arguments (i.e. C<< $c->request->arguments >>).
+
=item setup
Setups C<< $c->encoding >> with encoding specified in C<< $c->config->{encoding} >>.
Modified: Catalyst-Plugin-Unicode-Encoding/trunk/t/06request_decode.t
===================================================================
--- Catalyst-Plugin-Unicode-Encoding/trunk/t/06request_decode.t 2010-03-07 21:06:13 UTC (rev 13021)
+++ Catalyst-Plugin-Unicode-Encoding/trunk/t/06request_decode.t 2010-03-07 22:39:27 UTC (rev 13022)
@@ -58,3 +58,4 @@
ok utf8::is_utf8($foo);
is $foo => $decode_str;
}
+
More information about the Catalyst-commits
mailing list