summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README2
-rw-r--r--lib/VNDB/Util/CommonHTML.pm9
2 files changed, 7 insertions, 4 deletions
diff --git a/README b/README
index fe7778cc..77eed870 100644
--- a/README
+++ b/README
@@ -24,7 +24,7 @@ Requirements
(perl 5.12 core modules are not listed.)
util/vndb.pl:
- Algorithm::Diff::Fast
+ Algorithm::Diff::XS
DBI
DBD::Pg
TUWF (get it from http://g.blicky.net/tuwf.git/)
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;