about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-09-21 11:11:12 +0000
committerEric Wong <e@80x24.org>2015-09-21 11:37:33 +0000
commitf81ad477cb013d05b9b11fa051a9ebc5983a5be6 (patch)
tree20840db81ea8829e38a78c1b6a43d5ba6aafb9ff /lib
parent62f1d3057304ab1e598a3d3bff54fce1bca0dd72 (diff)
downloadpublic-inbox-f81ad477cb013d05b9b11fa051a9ebc5983a5be6.tar.gz
RFC 3977 stipulates the use of UTF-8 as the default charset,
so we shall try using that and hopefully not mangle things.
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/NNTP.pm5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm
index 2b580d16..91b10f20 100644
--- a/lib/PublicInbox/NNTP.pm
+++ b/lib/PublicInbox/NNTP.pm
@@ -8,7 +8,7 @@ use fields qw(nntpd article rbuf ng long_res);
 use PublicInbox::Msgmap;
 use PublicInbox::GitCatFile;
 use PublicInbox::MID qw(mid2path);
-use Email::Simple;
+use Email::MIME;
 use Data::Dumper qw(Dumper);
 use POSIX qw(strftime);
 use Time::HiRes qw(clock_gettime ualarm CLOCK_MONOTONIC);
@@ -29,6 +29,7 @@ my %DISABLED; # = map { $_ => 1 } qw(xover list_overview_fmt newnews xhdr);
 sub new ($$$) {
         my ($class, $sock, $nntpd) = @_;
         my $self = fields::new($class);
+        binmode $sock, ':utf8'; # RFC 3977
         $self->SUPER::new($sock);
         $self->{nntpd} = $nntpd;
         res($self, '201 server ready - post via email');
@@ -367,7 +368,7 @@ find_mid:
 found:
         my $o = 'HEAD:' . mid2path($mid);
         my $bytes;
-        my $s = eval { Email::Simple->new($ng->gcf->cat_file($o, \$bytes)) };
+        my $s = eval { Email::MIME->new($ng->gcf->cat_file($o, \$bytes)) };
         return $err unless $s;
         if ($set_headers) {
                 $s->header_set('Newsgroups', $ng->{name});