Merge 'trunk' into 'tweak_controller_action_creation'
Tomas Doran [Wed, 28 Jul 2010 21:37:00 +0000 (21:37 +0000)]
r15672@spaceinvaders (orig r13363):  jester | 2010-06-22 21:47:45 +0100
Fixed typo

r15674@spaceinvaders (orig r13365):  bricas | 2010-06-24 13:52:20 +0100
add typo fix to Changes
r15689@spaceinvaders (orig r13380):  arcanez | 2010-07-03 01:04:07 +0100
remove extra '
r15716@spaceinvaders (orig r13407):  hobbs | 2010-07-09 10:40:44 +0100
Try harder to make finalize_error encoding-safe.

Changes
lib/Catalyst.pm
lib/Catalyst/Engine.pm
lib/Catalyst/Script/Server.pm

diff --git a/Changes b/Changes
index f8ee533..39bfbc3 100644 (file)
--- a/Changes
+++ b/Changes
@@ -9,6 +9,7 @@
     point.
   - Explained the common practice how to access the component's config
     values.
+  - Fixed typo in Catalyst/Script/Server.pm (RT #58474)
 
 5.80024 2010-05-15 11:55:44
 
index f80f8a1..1013d21 100644 (file)
@@ -892,7 +892,7 @@ component is constructed.
 For example:
 
     MyApp->config({ 'Model::Foo' => { bar => 'baz', overrides => 'me' } });
-    MyApp::Model::Foo->config({ quux => 'frob', 'overrides => 'this' });
+    MyApp::Model::Foo->config({ quux => 'frob', overrides => 'this' });
 
 will mean that C<MyApp::Model::Foo> receives the following data when
 constructed:
index 509585f..e770f32 100644 (file)
@@ -10,6 +10,8 @@ use HTML::Entities;
 use HTTP::Body;
 use HTTP::Headers;
 use URI::QueryParam;
+use Encode ();
+use utf8;
 
 use namespace::clean -except => 'meta';
 
@@ -131,6 +133,14 @@ sub finalize_error {
 
     $c->res->content_type('text/html; charset=utf-8');
     my $name = ref($c)->config->{name} || join(' ', split('::', ref $c));
+    
+    # Prevent Catalyst::Plugin::Unicode::Encoding from running.
+    # This is a little nasty, but it's the best way to be clean whether or
+    # not the user has an encoding plugin.
+
+    if ($c->can('encoding')) {
+      $c->{encoding} = '';
+    }
 
     my ( $title, $error, $infos );
     if ( $c->debug ) {
@@ -279,11 +289,12 @@ sub finalize_error {
 </body>
 </html>
 
-
     # Trick IE. Old versions of IE would display their own error page instead
     # of ours if we'd give it less than 512 bytes.
     $c->res->{body} .= ( ' ' x 512 );
 
+    $c->res->{body} = Encode::encode("UTF-8", $c->res->{body});
+
     # Return 500
     $c->res->status(500);
 }
index e1f1049..45156e3 100644 (file)
@@ -231,7 +231,7 @@ Catalyst::Script::Server - Catalyst test server
                       a restart when modified
                       (defaults to '\.yml$|\.yaml$|\.conf|\.pm$')
    --rdir --restart_directory  the directory to search for
-                      modified files, can be set mulitple times
+                      modified files, can be set multiple times
                       (defaults to '[SCRIPT_DIR]/..')
    --sym  --follow_symlinks   follow symlinks in search directories
                       (defaults to false. this is a no-op on Win32)