diff options
author | Eric Wong <e@80x24.org> | 2016-05-30 04:50:33 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2016-05-30 04:50:33 +0000 |
commit | 682ecd3ad1eec32876f2705e6c60c7dfb30556aa (patch) | |
tree | fcf374ff20416d8ca1873d9ab1c92edb3383e024 /lib/PublicInbox/NNTP.pm | |
parent | 56692b57c4e6a404fee0ec8eef857f35e09ce767 (diff) | |
download | public-inbox-682ecd3ad1eec32876f2705e6c60c7dfb30556aa.tar.gz |
No need to duplicate the string when transforming it; learned from studying SpamAssassin 3.4.1
Diffstat (limited to 'lib/PublicInbox/NNTP.pm')
-rw-r--r-- | lib/PublicInbox/NNTP.pm | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm index 232237c2..e4e3de4a 100644 --- a/lib/PublicInbox/NNTP.pm +++ b/lib/PublicInbox/NNTP.pm @@ -16,8 +16,6 @@ use Email::Simple; use POSIX qw(strftime); use Time::HiRes qw(clock_gettime CLOCK_MONOTONIC); use URI::Escape qw(uri_escape_utf8); -use Encode qw(find_encoding); -my $enc_utf8 = find_encoding('UTF-8'); use constant { r501 => '501 command syntax error', r221 => '221 Header follows', @@ -898,7 +896,7 @@ sub cmd_xpath ($$) { sub res ($$) { my ($self, $line) = @_; - $line = $enc_utf8->encode($line); + utf8::encode($line); do_write($self, $line . "\r\n"); } @@ -933,7 +931,7 @@ use constant MSG_MORE => ($^O eq 'linux') ? 0x8000 : 0; sub do_more ($$) { my ($self, $data) = @_; - $data = $enc_utf8->encode($data); + utf8::encode($data); if (MSG_MORE && !$self->{write_buf_size}) { my $n = send($self->{sock}, $data, MSG_MORE); if (defined $n) { |