The aim is to find a way to: 1) not bust people who are doing the right
thing, 2) force people to do the right thing going forward, with new
apps, 3) make it easy for people doing the wrong thing to keep doing
the wrong thing if they don't or can't fix their apps.
Thus, lets basically set "encoding" bit to 'UTF-8' for apps loading the
plugin directly (unless provided something else) and remove the default
value.
$plugins = [ grep {
m/Unicode::Encoding/ ? do {
$class->log->warn(
- 'Unicode::Encoding plugin is now part of core,'
+ 'Unicode::Encoding plugin is auto-applied,'
. ' please remove this from your appclass'
+ . ' and make sure to define "encoding" config'
);
+ unless (exists $class->config->{'encoding'}) {
+ $class->config->{'encoding'} = 'UTF-8';
+ }
() }
: $_
} @$plugins ];
my $conf = $self->config;
# Allow an explict undef encoding to disable default of utf-8
- my $enc = exists $conf->{encoding} ? delete $conf->{encoding} : 'UTF-8';
+ my $enc = delete $conf->{encoding};
$self->encoding( $enc );
return $self->next::method(@_);
action_action_nine => { another_extra_arg => 13 }
}
},
+ encoding => 'UTF-8',
);
# Test bug found when re-adjusting the metaclass compat code in Moose
use Catalyst qw/Params::Nested/;
__PACKAGE__->config(
- encoding => $ENV{TESTAPP_ENCODING}
-) if $ENV{TESTAPP_ENCODING};
+ encoding => 'UTF-8'
+);
__PACKAGE__->config('name' => 'TestApp2');
or diag Dumper(\@TestLogger::LOGS);
like $TestLogger::LOGS[0], qr/content type is 'iso-8859-1'/;
-like $TestLogger::ELOGS[0], qr/plugin is now part of core/;
+like $TestLogger::ELOGS[0], qr/Unicode::Encoding plugin/;
done_testing;