summaryrefslogtreecommitdiff
path: root/LedgerSMB/Template.pm
diff options
context:
space:
mode:
Diffstat (limited to 'LedgerSMB/Template.pm')
-rwxr-xr-xLedgerSMB/Template.pm12
1 files changed, 8 insertions, 4 deletions
diff --git a/LedgerSMB/Template.pm b/LedgerSMB/Template.pm
index ba2cd221..90db6097 100755
--- a/LedgerSMB/Template.pm
+++ b/LedgerSMB/Template.pm
@@ -144,18 +144,22 @@ sub _http_output {
my $self = shift;
my $FH;
- print STDERR "Content-Type: $self->{mimetype}; charset=utf-8\n\n";
if ($self->{mimetype} =~ /^text/) {
print "Content-Type: $self->{mimetype}; charset=utf-8\n\n";
} else {
print "Content-Type: $self->{mimetype}\n\n";
}
- open($FH, '<', $self->{rendered}) or
+ open($FH, '<:bytes', $self->{rendered}) or
throw Error::Simple 'Unable to open rendered file';
- while (<$FH>) {
- print $_;
+ my $data;
+ {
+ local $/;
+ $data = <$FH>;
}
close($FH);
+ binmode STDOUT, ':bytes';
+ print $data;
+ binmode STDOUT, ':utf8';
unlink($self->{rendered}) or
throw Error::Simple 'Unable to delete output file';
exit;