[REVISED] 6996 Encoding problem in opac-showmarc

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[REVISED] 6996 Encoding problem in opac-showmarc

Marcel de Rooy
Decode the output from libxslt only if needed.
Add instruction to use UTF8 in html header.
---
 opac/opac-showmarc.pl |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/opac/opac-showmarc.pl b/opac/opac-showmarc.pl
index 4475512..2531eb1 100755
--- a/opac/opac-showmarc.pl
+++ b/opac/opac-showmarc.pl
@@ -29,6 +29,7 @@ use warnings;
 
 # standard or CPAN modules used
 use CGI;
+use Encode;
 
 # Koha modules used
 use C4::Context;
@@ -79,8 +80,8 @@ if ($view eq 'card' || $view eq 'html') {
     my $stylesheet = $xslt->parse_stylesheet($style_doc);
     my $results = $stylesheet->transform($source);
     my $newxmlrecord = $stylesheet->output_string($results);
-    print $input->header(), $newxmlrecord;
-    exit;
+    $newxmlrecord = Encode::decode_utf8($newxmlrecord) unless utf8::is_utf8($newxmlrecord);
+    print $input->header(-charset => 'UTF-8'), $newxmlrecord;
 } else {
     $record =GetMarcBiblio($biblionumber) unless $record;
     $template->param( MARC_FORMATTED => $record->as_formatted );
--
1.6.0.6

_______________________________________________
Koha-patches mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/