fixed utf-8 output

main
Rudis Muiznieks 5 months ago
parent a56ba058e4
commit 4338d05cf6
Signed by: rudism
GPG Key ID: CABF2F86EF7884F9
  1. 7
      server.pl

@ -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

Loading…
Cancel
Save