Both callers of load_from_data call utf8::decode, so just
do utf8::decode in load_from_data.
---
 lib/PublicInbox/Over.pm | 1 -
 lib/PublicInbox/Smsg.pm | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/PublicInbox/Over.pm b/lib/PublicInbox/Over.pm
index 2b314882..81b9fca7 100644
--- a/lib/PublicInbox/Over.pm
+++ b/lib/PublicInbox/Over.pm
@@ -68,7 +68,6 @@ sub load_from_row ($;$) {
        bless $smsg, 'PublicInbox::Smsg';
        if (defined(my $data = delete $smsg->{ddd})) {
                $data = uncompress($data);
-               utf8::decode($data);
                PublicInbox::Smsg::load_from_data($smsg, $data);
 
                # saves over 600K for 1000+ message threads
diff --git a/lib/PublicInbox/Smsg.pm b/lib/PublicInbox/Smsg.pm
index 62cb951e..f22cd43e 100644
--- a/lib/PublicInbox/Smsg.pm
+++ b/lib/PublicInbox/Smsg.pm
@@ -40,6 +40,7 @@ sub to_doc_data {
 
 sub load_from_data ($$) {
        my ($self) = $_[0]; # data = $_[1]
+       utf8::decode($_[1]);
        (
                $self->{subject},
                $self->{from},
@@ -67,7 +68,6 @@ sub load_expand {
        my $dt = get_val($doc, PublicInbox::Search::DT());
        my ($yyyy, $mon, $dd, $hh, $mm, $ss) = unpack('A4A2A2A2A2A2', $dt);
        $self->{ds} = timegm($ss, $mm, $hh, $dd, $mon - 1, $yyyy);
-       utf8::decode($data);
        load_from_data($self, $data);
        $self;
 }
--
unsubscribe: one-click, see List-Unsubscribe header
archive: https://public-inbox.org/meta/

Reply via email to