[Catalyst-commits] r11582 - in
Catalyst-Plugin-Unicode-Encoding/branches/support_upload_filename:
lib/Catalyst/Plugin/Unicode t
chiba at dev.catalyst.perl.org
chiba at dev.catalyst.perl.org
Fri Oct 16 18:02:07 GMT 2009
Author: chiba
Date: 2009-10-16 18:02:06 +0000 (Fri, 16 Oct 2009)
New Revision: 11582
Added:
Catalyst-Plugin-Unicode-Encoding/branches/support_upload_filename/t/06request_decode.t
Modified:
Catalyst-Plugin-Unicode-Encoding/branches/support_upload_filename/lib/Catalyst/Plugin/Unicode/Encoding.pm
Log:
add support_upload_filename
Modified: Catalyst-Plugin-Unicode-Encoding/branches/support_upload_filename/lib/Catalyst/Plugin/Unicode/Encoding.pm
===================================================================
--- Catalyst-Plugin-Unicode-Encoding/branches/support_upload_filename/lib/Catalyst/Plugin/Unicode/Encoding.pm 2009-10-16 17:43:47 UTC (rev 11581)
+++ Catalyst-Plugin-Unicode-Encoding/branches/support_upload_filename/lib/Catalyst/Plugin/Unicode/Encoding.pm 2009-10-16 18:02:06 UTC (rev 11582)
@@ -72,7 +72,7 @@
$c->next::method(@_);
}
-sub prepare_parameters {
+sub prepare_uploads {
my $c = shift;
$c->next::method(@_);
Added: Catalyst-Plugin-Unicode-Encoding/branches/support_upload_filename/t/06request_decode.t
===================================================================
--- Catalyst-Plugin-Unicode-Encoding/branches/support_upload_filename/t/06request_decode.t (rev 0)
+++ Catalyst-Plugin-Unicode-Encoding/branches/support_upload_filename/t/06request_decode.t 2009-10-16 18:02:06 UTC (rev 11582)
@@ -0,0 +1,43 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+use Test::More tests => 3 * 3;
+use utf8;
+
+# setup library path
+use FindBin qw($Bin);
+use lib "$Bin/lib";
+
+use Catalyst::Test 'TestApp';
+use Encode;
+use HTTP::Request::Common;
+use URI::Escape;
+
+my $encode_str = "\x{e3}\x{81}\x{82}"; # e38182 is japanese 'あ'
+my $decode_str = Encode::decode('utf-8' => $encode_str);
+my $escape_str = uri_escape_utf8($decode_str);
+
+check_parameter(GET "/?foo=$escape_str");
+check_parameter(POST '/', ['foo' => $encode_str]);
+check_parameter(POST '/',
+ Content_Type => 'form-data',
+ Content => [
+ 'foo' => [
+ "$Bin/06request_decode.t",
+ $encode_str,
+ ]
+ ],
+);
+
+
+sub check_parameter {
+ my ( undef, $c ) = ctx_request(shift);
+ is $c->res->output => '<h1>It works</h1>';
+
+ my $foo = $c->req->param('foo');
+ ok utf8::is_utf8($foo);
+ is $foo => $decode_str;
+}
+
+
More information about the Catalyst-commits
mailing list