Fix not to replace on UTF-8 string to avoid encoding issues (e.g. �)

This commit is contained in:
iliajie
2023-05-30 16:55:51 +03:00
parent 349a1f5873
commit e7a769ccf8

View File

@@ -2542,7 +2542,14 @@ else {
$html =~ s/<p>/\n\n/gi;
$html =~ s/<br>/\n/gi;
$html =~ s/<[^>]+>//g;
my $useutf8 = 0;
eval "use utf8";
$useutf8 = 1 if (!$@);
utf8::decode($html)
if ($useutf8);
$html = &entities_to_ascii($html);
utf8::encode($html)
if ($useutf8);
return $html;
}
}