From 140cbe930261e83eefb272e0c623aef1ebbe93d9 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 24 Oct 2016 17:14:33 +0200 Subject: [PATCH] Set utf-8 charset for raw logs Also fix incorrect use of Content-Encoding header in View::Plain. --- src/lib/Hydra/View/NixLog.pm | 2 +- src/lib/Hydra/View/Plain.pm | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/lib/Hydra/View/NixLog.pm b/src/lib/Hydra/View/NixLog.pm index fe10755c..99f144c7 100644 --- a/src/lib/Hydra/View/NixLog.pm +++ b/src/lib/Hydra/View/NixLog.pm @@ -9,7 +9,7 @@ sub process { my $logPath = $c->stash->{logPath}; - $c->response->content_type('text/plain'); + $c->response->content_type('text/plain; charset=utf-8'); my $fh = new IO::Handle; diff --git a/src/lib/Hydra/View/Plain.pm b/src/lib/Hydra/View/Plain.pm index d34cc44c..3e992471 100644 --- a/src/lib/Hydra/View/Plain.pm +++ b/src/lib/Hydra/View/Plain.pm @@ -6,8 +6,7 @@ use base 'Catalyst::View::Download::Plain'; sub process { my ($self, $c) = @_; - $c->response->content_encoding("utf-8"); - $c->response->content_type('text/plain') unless $c->response->content_type() ne ""; + $c->response->content_type('text/plain; charset=utf-8') unless $c->response->content_type() ne ""; $c->response->body($c->stash->{plain}->{data}); }