[Catalyst-commits] r14292 - in
Catalyst-Plugin-Unicode-Encoding/trunk:
lib/Catalyst/Plugin/Unicode t/lib/TestApp/Controller
t0m at dev.catalyst.perl.org
t0m at dev.catalyst.perl.org
Sat May 5 23:02:16 GMT 2012
Author: t0m
Date: 2012-05-05 23:02:16 +0000 (Sat, 05 May 2012)
New Revision: 14292
Modified:
Catalyst-Plugin-Unicode-Encoding/trunk/lib/Catalyst/Plugin/Unicode/Encoding.pm
Catalyst-Plugin-Unicode-Encoding/trunk/t/lib/TestApp/Controller/Root.pm
Log:
Unfuck, somewhat, still needs tests for RT#75006
Modified: Catalyst-Plugin-Unicode-Encoding/trunk/lib/Catalyst/Plugin/Unicode/Encoding.pm
===================================================================
--- Catalyst-Plugin-Unicode-Encoding/trunk/lib/Catalyst/Plugin/Unicode/Encoding.pm 2012-05-05 13:36:30 UTC (rev 14291)
+++ Catalyst-Plugin-Unicode-Encoding/trunk/lib/Catalyst/Plugin/Unicode/Encoding.pm 2012-05-05 23:02:16 UTC (rev 14292)
@@ -56,7 +56,7 @@
return $c->next::method(@_)
unless $c->response->content_type =~ /^text|xml$|javascript$/;
- if ($ct_enc && $ct_enc =~ /charset=([^;]*?)/) {
+ if ($ct_enc && $ct_enc =~ /charset=([^;]*)/) {
if (uc($1) ne $enc->mime_name) {
$c->log->debug("Unicode::Encoding is set to encode in '" .
$enc->mime_name .
Modified: Catalyst-Plugin-Unicode-Encoding/trunk/t/lib/TestApp/Controller/Root.pm
===================================================================
--- Catalyst-Plugin-Unicode-Encoding/trunk/t/lib/TestApp/Controller/Root.pm 2012-05-05 13:36:30 UTC (rev 14291)
+++ Catalyst-Plugin-Unicode-Encoding/trunk/t/lib/TestApp/Controller/Root.pm 2012-05-05 23:02:16 UTC (rev 14292)
@@ -7,10 +7,14 @@
use base 'Catalyst::Controller';
-# your actions replace this one
sub main :Path('') {
- $_[1]->res->body('<h1>It works</h1>');
- $_[1]->res->content_type('text/html');
+ my ($self, $ctx, $charset) = @_;
+ my $content_type = 'text/html';
+ if ($ctx->stash->{charset}) {
+ $content_type .= ";charset=" . $ctx->stash->{charset};
+ }
+ $ctx->res->body('<h1>It works</h1>');
+ $ctx->res->content_type($content_type);
}
sub unicode_no_enc :Local {
@@ -58,4 +62,10 @@
$c->forward('main');
}
+sub capture_charset : Chained('/') Args(1) {
+ my ( $self, $c, $cap_arg ) = @_;
+ $c->stash(charset => $cap_arg);
+ $c->forward('main');
+}
+
1;
More information about the Catalyst-commits
mailing list