From 763083c828fc36a2f6dec691f7e22c03d306ca10 Mon Sep 17 00:00:00 2001 From: M. de Rooy Date: Tue, 26 Mar 2013 20:12:36 +0100 Subject: [PATCH] Bug 6554 - followup - encode output, XSLT encoding from templates Encode output data instead of using binmode to be more compliant with various usage (e.g. plack). XSLT output_string seems to be depriciated call, decoding of newxmlrecord seems to be not necessary. --- C4/Output.pm | 3 ++- C4/XSLT.pm | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/C4/Output.pm b/C4/Output.pm index 458b92f..1c70e1a 100644 --- a/C4/Output.pm +++ b/C4/Output.pm @@ -308,8 +308,9 @@ sub output_with_http_headers { } sub output_html_with_http_headers { - binmode( STDOUT, ":encoding(utf8)" ); my ( $query, $cookie, $data, $status ) = @_; + $data =~ s/\&\;amp\; /\&\; /g && warn "DEBUG: fix double &"; + utf8::encode($data); output_with_http_headers( $query, $cookie, $data, 'html', $status ); } diff --git a/C4/XSLT.pm b/C4/XSLT.pm index 139ddd2..2b45c39 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -221,7 +221,8 @@ sub XSLTParse4Display { $stylesheet->{$xslfilename} = $xslt->parse_stylesheet($style_doc); } my $results = $stylesheet->{$xslfilename}->transform($source); - my $newxmlrecord = $stylesheet->{$xslfilename}->output_string($results); + my $newxmlrecord = $stylesheet->{$xslfilename}->output_as_chars($results); + #utf8::decode($newxmlrecord); # Bug 6554 - XSLT templates have utf-8 in header return $newxmlrecord; } -- 1.7.2.5