Subject: | Support for utf-8 in Log::Log4perl::Appender::Screen |
Hi,
win32 console doesn't support utf-8 by default hence we have to
explicitly specify binmode for STDOUT and STDERR to :utf8. ( I am not
sure if this is a issue on other platforms. )
I made the modifications in "Log::Log4perl::Appender::Screen" and have
attached the modified module file and the dif against original that
resolves this problem.
platform : activestate perl v 5.8.7 build 815 on windows XP sp2.
Error : "Wide character in print at
C:/Perl/site/lib/Log/Log4perl/Appender/Screen.pm line 28."
Regards,
Shantanu Bhadoria
http://www.shantanubhadoria.com
Subject: | screen.pm.diff |
--- C:\Documents and Settings\sbhadoria\Desktop\Screen_new.pm
+++ C:\Documents and Settings\sbhadoria\Desktop\Screen.pm
@@ -1,6 +1,8 @@
##################################################
package Log::Log4perl::Appender::Screen;
##################################################
+
+our @ISA = qw(Log::Log4perl::Appender);
use warnings;
use strict;
@@ -13,7 +15,6 @@
my $self = {
name => "unknown name",
stderr => 1,
- utf8 => undef,
@options,
};
@@ -24,12 +25,7 @@
sub log {
##################################################
my($self, %params) = @_;
-
- if (defined $self->{utf8}) {
- binmode STDERR, ":utf8";
- binmode STDOUT, ":utf8";
- }
-
+
if($self->{stderr}) {
print STDERR $params{message};
} else {