Package: drraw
Version: 2.2b2-4
Severity: normal
Tags: upstream patch

Hello,

The Perl CGI module generates a HTTP header using "Content-Type:
text/html; charset=ISO-8859-1".
See -charset documented at 
http://perldoc.perl.org/CGI.html#CREATING-A-STANDARD-HTTP-HEADER:

The tool used to generates the graphics uses UTF-8 as the encoding of
the graphic title.

So drraw must also use UTF-8 to encode user texts.

The attached patch does just that.

-- System Information:
Debian Release: 7.1
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 3.2.0-4-686-pae (SMP w/2 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages drraw depends on:
ii  librrds-perl  1.4.7-2

Versions of packages drraw recommends:
ii  apache2                      2.2.22-13
ii  apache2-mpm-prefork [httpd]  2.2.22-13
ii  librcs-perl                  1.05-4

Versions of packages drraw suggests:
ii  collectd  5.1.0-3

-- Configuration Files:
/etc/drraw/drraw.conf changed:
use strict;
%datadirs = ('/var/lib/collectd/rrd/localhost'  => '[collectd localhost] ',
             '/var/lib/meteo/rrd' => '[Meteo] ',
            );
@rranames = ( 'MIN', 'AVERAGE', 'MAX', 'LAST' );
%rranames = ( 'MIN'    => 'Min',
              'AVERAGE' => 'Avg',
              'MAX'     => 'Max',
              'LAST'    => 'Last'
              );
$saved_dir = '/var/lib/drraw';
$tmp_dir = '/var/cache/drraw';
$clean_cache = 21600; # 6 hours
1;


-- no debconf information

-- debsums errors found:
debsums: changed file /usr/lib/cgi-bin/drraw/drraw.cgi (from drraw package)
--- drraw.cgi.orig	2012-06-21 21:35:50.000000000 +0200
+++ drraw.cgi	2013-08-25 16:57:55.000000000 +0200
@@ -627,7 +627,7 @@
     # The graph/template browser pages, by default.
     #
     print
-        header,
+        header(-charset=>'UTF-8'),
         start_html(-style=>{-code=>$CSS}, -title=>'drraw - '. $title),
         $header,
         h1({-class=>'title'}, a({-href=>&MakeURL}, $title));
@@ -788,7 +788,7 @@
             &TMPLFind($TemplatesById{param('Template')}{'Filter'},
                       $TemplatesById{param('Template')}{'Display'});
             print
-                header,
+                header(-charset=>'UTF-8'),
                 start_html({-style=>{-code=>$CSS}, -title=>'drraw - '
                                 . $TemplatesById{param('Template')}{'Name'}}),
                 $header,
@@ -808,7 +808,7 @@
         } elsif ( defined(param('Dashboard'))
                   && !defined($BoardsById{param('Dashboard')}) ) {
             print
-                header,
+                header(-charset=>'UTF-8'),
                 start_html({-style=>{-code=>$CSS}, -title=>'drraw - '. $title}),
                 $header,
                 h1('Invalid Request.'),
@@ -821,7 +821,7 @@
             &BoardFind(param('Dashboard'));
             if ( scalar(keys(%DBTMPL)) > 0 && !defined(param('Base')) ) {
                 print
-                    header,
+                    header(-charset=>'UTF-8'),
                     start_html({-style=>{-code=>$CSS}, -title=>'drraw - '
                             . $BoardsById{param('Dashboard')}{'Name'}}),
                     $header,
@@ -912,7 +912,7 @@
 
                 # Header
                 print
-                    header,
+                    header(-charset=>'UTF-8'),
                     start_html({-style=>{-code=>$CSS}, -title=>'drraw - '
                                     . $BoardsById{$board}{'Name'},
                                     -head=>meta({-http_equiv=>'Refresh',
@@ -1558,7 +1558,7 @@
                 || ( $level == 1
                      && $user ne $BoardsById{$1}{'Owner'} ) ) {
                 print
-                    header,
+                    header(-charset=>'UTF-8'),
                     start_html(-style=>{-code=>$CSS},
                                -title=>'drraw - '. $title),
                     $header,
@@ -1567,7 +1567,7 @@
             } else {
                 unlink "${saved_dir}/d" . $1; # Untaint
                 print
-                    header,
+                    header(-charset=>'UTF-8'),
                     start_html(-style=>{-code=>$CSS}, -title=>'drraw - '.$title,
                                -head=>meta({-http_equiv=>'refresh',
                                             -content=>'1;URL=' .
@@ -1580,7 +1580,7 @@
             }
         } else {
             print
-                header,
+                header(-charset=>'UTF-8'),
                 start_html(-style=>{-code=>$CSS}, -title=>'drraw - '. $title),
                 $header,
                 h1({-class=>'title'}, a({-href=>&MakeURL}, $title)),
@@ -1588,7 +1588,7 @@
         }
     } else {
         print
-            header,
+            header(-charset=>'UTF-8'),
             start_html(-style=>{-code=>$CSS}, -title=>'drraw - '. $title),
             $header,
             h1({-class=>'title'}, a({-href=>&MakeURL}, $title));
@@ -1725,7 +1725,7 @@
                 || ( $level == 1
                      && $user ne $GraphsById{$1}{'Owner'} ) ) {
                 print
-                    header,
+                    header(-charset=>'UTF-8'),
                     start_html(-style=>{-code=>$CSS},
                                -title=>'drraw - '. $title),
                     $header,
@@ -1734,7 +1734,7 @@
             } else {
                 unlink "${saved_dir}/g" . $1; # Untaint
                 print
-                    header,
+                    header(-charset=>'UTF-8'),
                     start_html(-style=>{-code=>$CSS}, -title=>'drraw - '.$title,
                                -head=>meta({-http_equiv=>'refresh',
                                             -content=>'1;URL=' .
@@ -1751,7 +1751,7 @@
                 || ( $level == 1
                      && $user ne $TemplatesById{$1}{'Owner'} ) ){
                 print
-                    header,
+                    header(-charset=>'UTF-8'),
                     start_html(-style=>{-code=>$CSS},
                                -title=>'drraw - '. $title),
                     $header,
@@ -1760,7 +1760,7 @@
             } else {
                 unlink "${saved_dir}/t" . $1;
                 print
-                    header,
+                    header(-charset=>'UTF-8'),
                     start_html(-style=>{-code=>$CSS}, -title=>'drraw - '.$title,
                                -head=>meta({-http_equiv=>'refresh',
                                             -content=>'1;URL=' .
@@ -1773,7 +1773,7 @@
             }
         } else {
             print
-                header,
+                header(-charset=>'UTF-8'),
                 start_html(-style=>{-code=>$CSS}, -title=>'drraw - '. $title),
                 $header,
                 h1({-class=>'title'}, a({-href=>&MakeURL}, $title)),
@@ -1781,7 +1781,7 @@
         }
     } else {
         print
-            header,
+            header(-charset=>'UTF-8'),
             start_html(-style=>{-code=>$CSS}, -title=>'drraw - '. $title),
             $header,
             h1({-class=>'title'}, a({-href=>&MakeURL}, $title));
@@ -3805,6 +3805,7 @@
         } else {
             $out = '-';
             print header(-type=>$Mime{param('gFormat')},
+                         -charset=>'UTF-8',
                          -expires=>'+'. $ttl .'s',
                          -last_modified=>&time2str());
         }
@@ -3852,11 +3853,13 @@
         if ( !defined($ENV{'HTTP_IF_MODIFIED_SINCE'})
              || $ENV{'HTTP_IF_MODIFIED_SINCE'} ne $lm ) {
             print header(-type=>$Mime{param('gFormat')},
+                         -charset=>'UTF-8',
                          -expires=>&time2str($out), -last_modified=>$lm);
             while (<IMG>) { print; };
         } else {
             # Apache would do this for us, but why bother sending the data?
             print header(-status=>'304',
+                         -charset=>'UTF-8',
                          -type=>$Mime{param('gFormat')},
                          -expires=>&time2str($out), -last_modified=>$lm);
         }

Reply via email to