X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2FCatty%2FController%2FRoot.pm;h=735b1d00062a233d82af509d6ce0bb4cc67f0ee5;hb=4c96289cce33e758321f14dfc7ca35d3ebfa3fa4;hp=4d74605ccc758c43f4f623839d3f9de90d35c29c;hpb=127272a78225898ecf6932cb9245d1637b2c20e3;p=catagits%2FTest-WWW-Mechanize-Catalyst.git diff --git a/t/lib/Catty/Controller/Root.pm b/t/lib/Catty/Controller/Root.pm index 4d74605..735b1d0 100644 --- a/t/lib/Catty/Controller/Root.pm +++ b/t/lib/Catty/Controller/Root.pm @@ -2,12 +2,12 @@ package Catty::Controller::Root; use strict; use warnings; - use base qw/ Catalyst::Controller /; use Cwd; use MIME::Base64; use Encode (); +use utf8; __PACKAGE__->config( namespace => '' ); @@ -24,6 +24,10 @@ sub hello : Global { my $html = html( "Hello", "Hi there! $str" ); $context->response->content_type("text/html; charset=utf-8"); $context->response->output($html); + + # Newer Catalyst auto encodes UTF8, but this test case is borked and expects + # broken utf8 behavior. We'll make a real UTF8 Test case separately. + $context->clear_encoding if $context->can('clear_encoding'); # Compat with upcoming Catalyst 5.90080 } # absolute redirect @@ -121,7 +125,7 @@ sub gzipped : Global { # control both ends, so just always gzip the response. require Compress::Zlib; - my $html = html( "Hello", "Hi there! ☺" ); + my $html = Encode::encode('UTF-8', html( "Hello", "Hi there! ☺" )); $c->response->content_type("text/html; charset=utf-8"); $c->response->output( Compress::Zlib::memGzip($html) ); $c->response->content_encoding('gzip'); @@ -144,5 +148,12 @@ sub bad_content_encoding :Global { $c->res->body('foo'); } +sub redirect_to_utf8_upgraded_string : Global { + my($self, $c) = @_; + my $where = $c->uri_for('hello', 'müller')->as_string; + utf8::upgrade($where); + $c->res->redirect($where); +} + 1;