Bug 10549: (follow-up) make sure ILS-DI GetAvailability response is emitted as UTF-8
authorGalen Charlton <gmc@esilibrary.com>
Wed, 17 Jul 2013 19:12:34 +0000 (19:12 +0000)
committerChris Hall <followingthepath@gmail.com>
Sun, 15 Sep 2013 05:18:29 +0000 (17:18 +1200)
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit da6f2f7a7ddf1126d6e3b02825f0d45948f484fa)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
(cherry picked from commit 1ebaaa8c4b3c27afa9fd2ef67a9430fafb82b544)
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
(cherry picked from commit 1ebaaa8c4b3c27afa9fd2ef67a9430fafb82b544)
Signed-off-by: Chris Hall <followingthepath@gmail.com>
(cherry picked from commit 99706d790038e6bc0ea230f803946cd41845ddaa)

opac/ilsdi.pl

index 419c0f2..d68f09a 100755 (executable)
@@ -143,6 +143,10 @@ if ( $cgi->param('service') eq "Describe" and any { $cgi->param('verb') eq $_ }
     exit 0;
 }
 
+# any output after this point will be UTF-8 XML
+binmode STDOUT, ':encoding(UTF-8)';
+print CGI::header('-type'=>'text/xml', '-charset'=>'utf-8');
+
 my $out;
 
 # If ILS-DI module is disabled in System->Preferences, redirect to 404
@@ -207,7 +211,6 @@ if ( $service and any { $service eq $_ } @services ) {
 
         # GetAvailability is a special case, as it cannot use XML::Simple
         if ( $service eq "GetAvailability" ) {
-            print CGI::header('text/xml');
             print C4::ILSDI::Services::GetAvailability($cgi);
             exit 0;
         } else {
@@ -228,8 +231,6 @@ if ( $service and any { $service eq $_ } @services ) {
 }
 
 # Output XML by passing the hashref to XMLOut
-binmode STDOUT, ':encoding(UTF-8)';
-print CGI::header('-type'=>'text/xml', '-charset'=>'utf-8');
 print XMLout(
     $out,
     noattr        => 1,