Fixed text encoding.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Mon, 15 Nov 2010 12:11:23 +0000 (12:11 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Mon, 15 Nov 2010 12:11:23 +0000 (12:11 +0000)
reporting/includes/class.graphic.inc

index 02af5f2ad97cb4287a4385a07ee0f1554ccb345a..30daf8a1ee0b00fe714af5408fb7349267cddaf7 100644 (file)
@@ -150,6 +150,7 @@ class graph
 
     function graph()
     {
+
         $this->x = $this->y = $this->z = array();
 
         $this->biggest_x        = NULL;
@@ -944,6 +945,15 @@ class graph
     {
                if ($alt && strlen($string) > 12)
                        $string = substr($string, 0, 12);
+
+               $encoding = $_SESSION['language']->encoding;
+               if ($encoding != 'UTF-8') {
+                       if (function_exists('iconv'))
+                               $string = iconv($encoding, 'UTF-8', $string);
+                       else
+                               $string = mb_convert_encoding($string, 'UTF-8', $encoding);
+               }
+
        if ($this->built_in)
        {
                imagestring($img, $size, $x, $y + $alt, $string, $col);
@@ -965,6 +975,7 @@ class graph
                //      $angle = -15;
                //else
                                $angle = 0;
+
                imagettftext($img, $size, $angle, $x, $y + $alt, $col, $this->fontfile, $string);
        }
     }