about summary refs log tree commit homepage
path: root/lib/PublicInbox/Hval.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-12-22 02:30:28 +0000
committerEric Wong <e@80x24.org>2016-04-05 18:58:27 +0000
commit54c10e3aac3020b83a3be0b9578894154bd3de6a (patch)
tree790927fb0438188211f3e90c4f98640e259a691c /lib/PublicInbox/Hval.pm
parentc2a9bc53532ace22dbb143ef7df65cf063ae6e4f (diff)
downloadpublic-inbox-54c10e3aac3020b83a3be0b9578894154bd3de6a.tar.gz
Since we no longer get our data from Email::MIME when reading
non-email, we need to explicitly specify it as such.
Diffstat (limited to 'lib/PublicInbox/Hval.pm')
-rw-r--r--lib/PublicInbox/Hval.pm11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/PublicInbox/Hval.pm b/lib/PublicInbox/Hval.pm
index 70bae7c6..2e8b1d60 100644
--- a/lib/PublicInbox/Hval.pm
+++ b/lib/PublicInbox/Hval.pm
@@ -18,8 +18,19 @@ our @EXPORT_OK = qw/ascii_html/;
 use constant STYLE => '<style>pre{white-space:pre-wrap}</style>';
 use constant PRE => "<pre\nstyle=\"white-space:pre-wrap\">"; # legacy
 
+my $enc_utf8 = find_encoding('UTF-8');
 my $enc_ascii = find_encoding('us-ascii');
 
+sub new_bin {
+        my ($class, $raw, $href) = @_;
+
+        $raw = $enc_utf8->decode($raw);
+        bless {
+                raw => $raw,
+                href => defined $href ? $href : $raw,
+        }, $class;
+}
+
 sub new {
         my ($class, $raw, $href) = @_;