about summary refs log tree commit homepage
path: root/lib/PublicInbox/HlMod.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PublicInbox/HlMod.pm')
-rw-r--r--lib/PublicInbox/HlMod.pm7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/PublicInbox/HlMod.pm b/lib/PublicInbox/HlMod.pm
index 237ffaca..decfd714 100644
--- a/lib/PublicInbox/HlMod.pm
+++ b/lib/PublicInbox/HlMod.pm
@@ -107,7 +107,12 @@ sub do_hl {
                 $g->setEncoding('utf-8');
                 $g;
         };
-        \($gen->generateString($$str))
+
+        # we assume $$str is valid UTF-8, but the SWIG binding doesn't
+        # know that, so ensure it's marked as UTF-8 even if it isnt...
+        my $out = $gen->generateString($$str);
+        utf8::decode($out);
+        \$out;
 }
 
 # SWIG instances aren't reference-counted, but $self is;