[Koha-patches] [PATCH] bug 2246: encode label text in call to pdf print function.

Ryan Higgins rch at liblime.com
Sun Sep 7 08:39:34 CEST 2008


This resolves a 'wide character' error causing a broken pdf to be generated.
It does not address the absence of Hindi or other fonts in pdf display applications,
Tested with the supplied hindi utf8 string in the bug report, this prevents the failure
on the server, and allows a valid pdf document to be created.
---
 C4/Labels.pm |   11 ++---------
 1 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/C4/Labels.pm b/C4/Labels.pm
index 6531164..1b0ba6c 100644
--- a/C4/Labels.pm
+++ b/C4/Labels.pm
@@ -28,7 +28,7 @@ use C4::Branch;
 use C4::Debug;
 use C4::Biblio;
 use Text::CSV_XS;
-use Data::Dumper;
+use Encode;
 
 BEGIN {
 	$VERSION = 0.03;
@@ -502,7 +502,6 @@ sub GetAllLabelTemplates {
     }
     $sth->finish;
 
-    #warn Dumper @resultsloop;
     return @resultsloop;
 }
 
@@ -1108,7 +1107,7 @@ sub DrawSpineText {
                 } else {
                     $hPos = ( $x_pos + $left_text_margin );
                 }
-                PrintText( $hPos, $vPos, $font, $fontsize, $str );
+                PrintText( $hPos, $vPos, $font, $fontsize,  encode('utf8',$str) );
                 $vPos = $vPos - $line_spacer;
             }
     	}
@@ -1298,12 +1297,6 @@ $item is the result of a previous call to GetLabelItems();
 sub build_circ_barcode {
     my ( $x_pos_circ, $y_pos, $value, $barcodetype, $item ) = @_;
 
-    #warn Dumper \$item;
-
-    #warn "value = $value\n";
-
-    #$DB::single = 1;
-
     if ( $barcodetype eq 'EAN13' ) {
 
         #testing EAN13 barcodes hack
-- 
1.5.5.GIT




More information about the Koha-patches mailing list