diff options
author | Eric Wong <e@80x24.org> | 2019-02-01 22:12:52 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2019-02-05 04:35:29 +0000 |
commit | 738f4daed7f0555f7ac11dc2f527bc53dddd4e5b (patch) | |
tree | 13eae96b43d8f07c7bf1b94ae795384fb6fd7a6c /lib/PublicInbox/ViewVCS.pm | |
parent | 390441cbff937a6048c257df9c91474d63a629bc (diff) | |
download | public-inbox-738f4daed7f0555f7ac11dc2f527bc53dddd4e5b.tar.gz |
Favor in-place utf8::decode since it's a bit faster without method dispatch overhead; and don't care about validity just yet. HlMod->do_hl itself should return "utf8" strings, since other parts of our code can use it, so it's not the job of ViewVCS to post-process HlMod output.
Diffstat (limited to 'lib/PublicInbox/ViewVCS.pm')
-rw-r--r-- | lib/PublicInbox/ViewVCS.pm | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/PublicInbox/ViewVCS.pm b/lib/PublicInbox/ViewVCS.pm index d67b5eb4..acdd822d 100644 --- a/lib/PublicInbox/ViewVCS.pm +++ b/lib/PublicInbox/ViewVCS.pm @@ -16,7 +16,6 @@ package PublicInbox::ViewVCS; use strict; use warnings; -use Encode qw(find_encoding); use PublicInbox::SolverGit; use PublicInbox::WwwStream; use PublicInbox::Linkify; @@ -33,7 +32,6 @@ END { $hl = undef }; my %QP_MAP = ( A => 'oid_a', B => 'oid_b', a => 'path_a', b => 'path_b' ); my $max_size = 1024 * 1024; # TODO: configurable -my $enc_utf8 = find_encoding('UTF-8'); my $BIN_DETECT = 8000; # same as git sub html_page ($$$) { @@ -122,14 +120,14 @@ sub solve_result { return html_page($ctx, 200, \$log); } - $$blob = $enc_utf8->decode($$blob); + # TODO: detect + convert to ensure validity + utf8::decode($$blob); my $nl = ($$blob =~ tr/\n/\n/); my $pad = length($nl); $l->linkify_1($$blob); my $ok = $hl->do_hl($blob, $path) if $hl; if ($ok) { - $$ok = $enc_utf8->decode($$ok); src_escape($$ok); $blob = $ok; } else { |