From b9b12ac92230cc6807623293b93cc22e5eb33684 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 3 Mar 2017 00:55:07 +0000 Subject: repobrowse: consistently set text charset For everything with relevant content, we'll try to set UTF-8 charset and reduce duplication when generating response headers. --- lib/PublicInbox/RepoBase.pm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib/PublicInbox/RepoBase.pm') diff --git a/lib/PublicInbox/RepoBase.pm b/lib/PublicInbox/RepoBase.pm index 9876cf2a..e600b1df 100644 --- a/lib/PublicInbox/RepoBase.pm +++ b/lib/PublicInbox/RepoBase.pm @@ -105,10 +105,17 @@ sub r { # mainly for curl (no-'-L') users: $body = "Redirecting to $redir\n"; } else { - push @h, qw(Content-Type text/plain); + push @h, 'Content-Type', 'text/plain; charset=UTF-8'; } [ $status, \@h, [ $body ] ] } +sub rt { + my ($self, $status, $t) = @_; + my $res = [ $status, [ 'Content-Type', "text/$t; charset=UTF-8" ] ]; + $res->[2] = [ $_[3] ] if defined $_[3]; + $res; +} + 1; -- cgit v1.2.3-24-ge0c7