fixed utf-8 output

This commit is contained in:
Rudis Muiznieks 2022-05-08 15:12:59 -05:00
parent a56ba058e4
commit 4338d05cf6
Signed by: rudism
GPG Key ID: CABF2F86EF7884F9
1 changed files with 6 additions and 1 deletions

View File

@ -239,7 +239,11 @@ my $enable_experimental_features = $ENV{'ENABLE_EXPERIMENTAL_FEATURES' } || 0;
? encode_json({error => $resp_body->{$code}})
: $resp_body->{$code};
}
my $length = defined $body ? length($body) : 0;
my $length;
{
use bytes;
$length = defined $body ? length($body) : 0;
};
$body = '' if !defined $body || $cgi->request_method() eq 'HEAD';
my $length_header = '';
if ($length > 0) {
@ -252,6 +256,7 @@ my $enable_experimental_features = $ENV{'ENABLE_EXPERIMENTAL_FEATURES' } || 0;
my $val = $headers->{$header};
$extra_headers .= "\n$header: $val";
}
binmode STDOUT, ':utf8';
print <<EOF;
HTTP/1.1 $code $code_description
Server: DotplanApi