set binmode encoding on STDERR when setting Encoding in config
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Plugin / Unicode / Encoding.pm
index d22a96f..022efd2 100644 (file)
@@ -23,6 +23,10 @@ sub encoding {
         if (my $wanted = shift)  {
             $encoding = Encode::find_encoding($wanted)
               or Carp::croak( qq/Unknown encoding '$wanted'/ );
+            binmode(STDERR, ':encoding(' . $encoding->name . ')');
+        }
+        else {
+            binmode(STDERR);
         }
 
         $encoding = ref $c
@@ -201,7 +205,7 @@ Catalyst::Plugin::Unicode::Encoding - Unicode aware Catalyst
 
 This plugin is automatically loaded by apps. Even though is not a core component
 yet, it will vanish as soon as the code is fully integrated. For more
-information, please refer to C<ENCODING> section at L<Catalyst>.
+information, please refer to L<Catalyst/ENCODING>.
 
 =head1 AUTHORS