Bug 8176 [SIGNED-OFF] Assign an intial value to $sqlwhere
[koha.git] / C4 / Creators / PDF.pm
index e99e6e8..0aae09c 100644 (file)
@@ -49,6 +49,8 @@ sub new {
 
 sub End {
     my $self = shift;
+    # if the pdf stream is utf8, explicitly set it to utf8; this avoids at lease some wide character errors -chris_n
+    utf8::encode($PDF::Reuse::stream) if utf8::is_utf8($PDF::Reuse::stream);
     prEnd();
 }
 
@@ -152,8 +154,8 @@ sub Jpeg {
 sub prAltJpeg
 {  my ($iData, $iWidth, $iHeight, $iFormat,$aiData, $aiWidth, $aiHeight, $aiFormat) = @_;
    my ($namnet, $utrad);
-   if (! $PDF::Reuse::pos) {                  # If no output is active, it is no use to continue
-      return;
+   if (! $PDF::Reuse::pos)                    # If no output is active, it is no use to continue
+   {   return undef;
    }
    prJpegBlob($aiData, $aiWidth, $aiHeight, $aiFormat);
    my $altObjNr = $PDF::Reuse::objNr;
@@ -182,8 +184,8 @@ sub prAltJpeg
 sub prJpegBlob
 {  my ($iData, $iWidth, $iHeight, $iFormat, $altArrayObjNr) = @_;
    my ($iLangd, $namnet, $utrad);
-   if (! $PDF::Reuse::pos) {                  # If no output is active, it is no use to continue
-       return;
+   if (! $PDF::Reuse::pos)                    # If no output is active, it is no use to continue
+   {   return undef;
    }
    my $checkidOld = $PDF::Reuse::checkId;
    if (!$iFormat)