encode unicode to utf8 by default (in finalize)
Jonathan Rockway [Sun, 13 Jan 2008 22:45:35 +0000 (22:45 +0000)]
Changes
lib/Catalyst.pm

diff --git a/Changes b/Changes
index 479ba64..d78cc17 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,9 @@
 # This file documents the revision history for Perl extension Catalyst.
 
+5.7013  
+        - convert perl characters to utf8 before output 
+          (Catalyst::Plugin::Unicode no longer needed for output)
+
 5.7012  2007-12-16 23:44:00
         - Fix __PACKAGE__->config->{foo} = 'bar' case with subclassing
         - Add Catalyst::Stats (Jon Schutz)
index 96ad9a5..01d0d5f 100644 (file)
@@ -1335,6 +1335,11 @@ sub finalize {
         $c->log->error($error);
     }
 
+    # utf8-encode the body (convert perl chars to utf8 on the wire)
+    if ( $c->response->{body} && utf8::is_utf8($c->response->{body}) ){
+        utf8::encode( $c->response->{body} );
+    }
+    
     # Allow engine to handle finalize flow (for POE)
     if ( $c->engine->can('finalize') ) {
         $c->engine->finalize($c);