diff options
Diffstat (limited to 'lib/PublicInbox/Hval.pm')
-rw-r--r-- | lib/PublicInbox/Hval.pm | 11 |
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) = @_; |