Bug 6996: Encoding problem in opac-showmarc
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Wed, 12 Oct 2011 12:43:53 +0000 (14:43 +0200)
committerChris Cormack <chrisc@catalyst.net.nz>
Wed, 19 Oct 2011 03:39:07 +0000 (16:39 +1300)
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
No more encoding problems spotted.

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
opac/opac-showmarc.pl

index 4475512..673069e 100755 (executable)
 use strict;
 use warnings;
 
+use open OUT=>':utf8', ':std';
+
 # standard or CPAN modules used
 use CGI;
+use Encode;
 
 # Koha modules used
 use C4::Context;
@@ -79,8 +82,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 );