diff options
author | Yorhel <git@yorhel.nl> | 2011-05-01 19:57:45 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2011-05-01 19:57:45 +0200 |
commit | 50a94610a570c16f1e4c9ffcadc60739d4a30b82 (patch) | |
tree | 35363f405c4f9743d60e28027a4b665c7065d163 /lib | |
parent | 3f9a29620285fe0ea86f8f09425ce28503ad8326 (diff) |
Switched back to Algorithm::Diff::XS
Algorithm::Diff::Fast suddenly disappeared for some reason...
Diffstat (limited to 'lib')
-rw-r--r-- | lib/VNDB/Util/CommonHTML.pm | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/VNDB/Util/CommonHTML.pm b/lib/VNDB/Util/CommonHTML.pm index 5f2fb330..691d9887 100644 --- a/lib/VNDB/Util/CommonHTML.pm +++ b/lib/VNDB/Util/CommonHTML.pm @@ -5,7 +5,8 @@ use strict; use warnings; use TUWF ':html', 'xml_escape', 'html_escape'; use Exporter 'import'; -use Algorithm::Diff::Fast 'compact_diff'; +use Algorithm::Diff::XS 'compact_diff'; +use Encode 'encode_utf8', 'decode_utf8'; use VNDB::Func; use POSIX 'ceil'; @@ -244,8 +245,8 @@ sub revdiff { if($o{diff} && $ser1 && $ser2) { my $sep = ref $o{diff} ? qr/($o{diff})/ : qr//; - my @ser1 = $o{split} ? $o{split}->($ser1) : map html_escape($_), split $sep, $ser1; - my @ser2 = $o{split} ? $o{split}->($ser2) : map html_escape($_), split $sep, $ser2; + my @ser1 = map encode_utf8($_), $o{split} ? $o{split}->($ser1) : map html_escape($_), split $sep, $ser1; + my @ser2 = map encode_utf8($_), $o{split} ? $o{split}->($ser2) : map html_escape($_), split $sep, $ser2; return if $o{split} && $#ser1 == $#ser2 && !grep $ser1[$_] ne $ser2[$_], 0..$#ser1; $ser1 = $ser2 = ''; @@ -257,6 +258,8 @@ sub revdiff { $ser1 .= ($ser1?$o{join}:'').($i % 2 ? qq|<b class="diff_del">$a</b>| : $a) if $a ne ''; $ser2 .= ($ser2?$o{join}:'').($i % 2 ? qq|<b class="diff_add">$b</b>| : $b) if $b ne ''; } + $ser1 = decode_utf8($ser1); + $ser2 = decode_utf8($ser2); } elsif(!$o{htmlize}) { $ser1 = html_escape $ser1; $ser2 = html_escape $ser2; |