about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--lib/PublicInbox/Feed.pm2
-rw-r--r--lib/PublicInbox/Hval.pm15
2 files changed, 14 insertions, 3 deletions
diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm
index 2dc3940f..bddba912 100644
--- a/lib/PublicInbox/Feed.pm
+++ b/lib/PublicInbox/Feed.pm
@@ -286,7 +286,7 @@ sub add_to_feed {
                 author => { name => $name, email => $email },
                 title => $subject,
                 updated => $date,
-                content => { type => "html", content => $content },
+                content => { type => 'xhtml', content => $content },
                 link => $midurl . $href,
                 id => 'urn:uuid:' . join('-', @uuid5),
         );
diff --git a/lib/PublicInbox/Hval.pm b/lib/PublicInbox/Hval.pm
index 09ae2676..1a83cf10 100644
--- a/lib/PublicInbox/Hval.pm
+++ b/lib/PublicInbox/Hval.pm
@@ -7,7 +7,6 @@ use strict;
 use warnings;
 use fields qw(raw);
 use Encode qw(find_encoding);
-use CGI qw(escapeHTML);
 use URI::Escape qw(uri_escape);
 
 my $enc_ascii = find_encoding('us-ascii');
@@ -38,7 +37,19 @@ sub new_oneline {
         $class->new($raw);
 }
 
-sub ascii_html { $enc_ascii->encode(escapeHTML($_[0]), Encode::HTMLCREF) }
+my %xhtml_map = (
+        '"' => '"',
+        '&' => '&',
+        "'" => ''',
+        '<' => '&lt;',
+        '>' => '&gt;',
+);
+
+sub ascii_html {
+        my ($s) = @_;
+        $s =~ s/([<>&'"])/$xhtml_map{$1}/ge;
+        $enc_ascii->encode($s, Encode::HTMLCREF);
+}
 
 sub as_html { ascii_html($_[0]->{raw}) }
 sub as_href { ascii_html(uri_escape($_[0]->{raw})) }