diff -upr SVN-Web-0.53.org/lib/SVN/Web/Blame.pm SVN-Web-0.53.Jcode/lib/SVN/Web/Blame.pm --- SVN-Web-0.53.org/lib/SVN/Web/Blame.pm Mon Apr 30 04:22:51 2007 +++ SVN-Web-0.53.Jcode/lib/SVN/Web/Blame.pm Sun Aug 22 15:04:21 2010 @@ -2,6 +2,7 @@ package SVN::Web::Blame; use strict; use warnings; +use Jcode; use base 'SVN::Web::action'; @@ -133,6 +134,18 @@ sub run { my $rev = $act_rev; + my $mime_type; + my $charset = ''; + my $props = $ctx->propget('svn:mime-type', $uri . $path, $rev, 0); + if(exists $props->{$uri . $path}) { + $mime_type = $props->{$uri . $path}; + if ($mime_type =~ /(^|;)[ ]*charset[ ]*=[ ]*(.+?)($|;)/) { + $charset = $2; + } + } else { + $mime_type = 'text/plain'; + } + my @blame_details; $ctx->blame("$uri$path", 1, $rev, sub { @@ -141,17 +154,9 @@ sub run { rev => $_[1], author => $_[2], date => $self->format_svn_timestamp($_[3]), - line => $_[4], + line => Jcode->new($_[4],$charset)->utf8, }; }); - - my $mime_type; - my $props = $ctx->propget('svn:mime-type', $uri . $path, $rev, 0); - if(exists $props->{$uri . $path}) { - $mime_type = $props->{$uri . $path}; - } else { - $mime_type = 'text/plain'; - } return { template => 'blame', diff -upr SVN-Web-0.53.org/lib/SVN/Web/DiffParser.pm SVN-Web-0.53.Jcode/lib/SVN/Web/DiffParser.pm --- SVN-Web-0.53.org/lib/SVN/Web/DiffParser.pm Mon Apr 30 04:22:51 2007 +++ SVN-Web-0.53.Jcode/lib/SVN/Web/DiffParser.pm Wed Jun 2 03:47:21 2010 @@ -7,6 +7,7 @@ use vars qw( $VERSION ); use Carp; use IO::File; +use Jcode; $VERSION = '0.53'; $VERSION = eval $VERSION; # see L @@ -197,7 +198,9 @@ sub parse #################################################### sub _parse_line { - my( $self, $line ) = @_; + my( $self, $line_tmp ) = @_; + # Convert the character set + my $line = Jcode->new($line_tmp)->utf8; $self->{verbose} and warn "Parsing $line"; my $state = $self->{state}; diff -upr SVN-Web-0.53.org/lib/SVN/Web/View.pm SVN-Web-0.53.Jcode/lib/SVN/Web/View.pm --- SVN-Web-0.53.org/lib/SVN/Web/View.pm Mon Apr 30 04:22:51 2007 +++ SVN-Web-0.53.Jcode/lib/SVN/Web/View.pm Thu Sep 3 06:11:25 2009 @@ -2,6 +2,7 @@ package SVN::Web::View; use strict; use warnings; +use Jcode; use base 'SVN::Web::action'; @@ -134,6 +135,7 @@ sub run { my $rev = $act_rev; # Get the log for this revision of the file + $path =~ s/^\/$//; $ra->get_log([$path], $rev, $rev, 1, 1, 1, sub { $self->{REV} = $self->_log(@_) }); @@ -144,13 +146,25 @@ sub run { close($fc); my $mime_type; + my $charset = ''; my $props = $ctx->propget('svn:mime-type', $uri . $path, $rev, 0); if(exists $props->{$uri . $path}) { $mime_type = $props->{$uri . $path}; + if ($mime_type =~ /(^|;)[ ]*charset[ ]*=[ ]*(.+?)($|;)/) { + $charset = $2; + } } else { $mime_type = 'text/plain'; } + # Convert the character set + my $fc_u8; + if (length($charset) < 1) { + $fc_u8 = Jcode->new($fc)->utf8; + } else { + $fc_u8 = Jcode->new($fc,$charset)->utf8; + } + return { template => 'view', data => { @@ -159,7 +173,7 @@ sub run { youngest_rev => $yng_rev, at_head => $head, mimetype => $mime_type, - file => $fc, + file => $fc_u8, %{ $self->{REV} }, } };