Просмотр исходного кода

Add 'charset' option to define the charset

Morten Brix Pedersen 25 лет назад
Родитель
Сommit
c1fcd7efc5
3 измененных файлов с 46 добавлено и 40 удалено
  1. 3 2
      docs/CONFIG-README
  2. 38 37
      modules/Pisg.pm
  3. 5 1
      modules/Pisg/HTMLGenerator.pm

+ 3 - 2
docs/CONFIG-README

@@ -76,8 +76,7 @@ All the different options are listed below.
 Other examples:
 <set lang='EN' langfile='lang.txt'>
 <set bgcolor="#dedeee" text="black" hbgcolor="#666699" hcolor="white" hicell="#BABADD" hicell2="#CCCCCC">
-<set activenicks="25" activenicks2="30" topichistory="3" nicktracking="0" timeoffset="+0">
-
+<set topichistory="3" timeoffset="+0">
 
 There is many options which can be set, here's a list of them all (not
 casesensitive):
@@ -174,6 +173,8 @@ regexp_alises       1 or 0, enabling this will make aliases in <user> tags
 silent              1 or 0.  Enabling this will suppress all standard output
                     from pisg.  Error messages will still be sent to STDOUT.
 
+charset             Charset to use for stats page, default is 'iso-8859-1'.
+
  * Colors / layout for your stats page *
 
 bgcolor             Background color of the page

+ 38 - 37
modules/Pisg.pm

@@ -103,51 +103,51 @@ sub get_default_config_settings
     # constructor.
 
     $self->{cfg} = {
-        channel => "",
-        logtype => "Logfile",
-        logfile => "",
-        format => "mIRC",
-        network => "SomeIRCNet",
-        outputfile => "index.html",
-        maintainer => "MAINTAINER",
-        pagehead => "none",
-        configfile => "pisg.cfg",
-        imagepath => "",
-        logdir => "",
+        channel => '',
+        logtype => 'Logfile',
+        logfile => '',
+        format => 'mIRC',
+        network => 'SomeIRCNet',
+        outputfile => 'index.html',
+        maintainer => 'MAINTAINER',
+        pagehead => 'none',
+        configfile => 'pisg.cfg',
+        imagepath => '',
+        logdir => '',
         lang => 'EN',
         langfile => 'lang.txt',
-        prefix => "",
+        prefix => '',
         silent => 0,
 
         # Colors / Layout
 
-        bgcolor => "#dedeee",
+        bgcolor => '#dedeee',
         bgpic => '',
-        text => "black",
-        hbgcolor => "#666699",
-        hcolor => "white",
-        hicell => "#BABADD",
-        hicell2 => "#CCCCCC",
-        tdcolor => "black",
-        tdtop => "#C8C8DD",
-        link => "#0b407a",
-        vlink => "#0b407a",
-        hlink => "#0b407a",
-        headline => "#000000",
-        rankc => "#CCCCCC",
-        hi_rankc => "#AAAAAA",
+        text => 'black',
+        hbgcolor => '#666699',
+        hcolor => 'white',
+        hicell => '#BABADD',
+        hicell2 => '#CCCCCC',
+        tdcolor => 'black',
+        tdtop => '#C8C8DD',
+        link => '#0b407a',
+        vlink => '#0b407a',
+        hlink => '#0b407a',
+        headline => '#000000',
+        rankc => '#CCCCCC',
+        hi_rankc => '#AAAAAA',
 
         pic_width => '',
         pic_height => '',
 
-        pic_v_0 => "blue-v.png",
-        pic_v_6 => "green-v.png",
-        pic_v_12 => "yellow-v.png",
-        pic_v_18 => "red-v.png",
-        pic_h_0 => "blue-h.png",
-        pic_h_6 => "green-h.png",
-        pic_h_12 => "yellow-h.png",
-        pic_h_18 => "red-h.png",
+        pic_v_0 => 'blue-v.png',
+        pic_v_6 => 'green-v.png',
+        pic_v_12 => 'yellow-v.png',
+        pic_v_18 => 'red-v.png',
+        pic_h_0 => 'blue-h.png',
+        pic_h_6 => 'green-h.png',
+        pic_h_12 => 'yellow-h.png',
+        pic_h_18 => 'red-h.png',
 
         # Stats settings
 
@@ -170,6 +170,7 @@ sub get_default_config_settings
 
         # Less important things
 
+        timeoffset => '+0',
         minquote => 25,
         maxquote => 65,
         wordlength => 5,
@@ -177,7 +178,7 @@ sub get_default_config_settings
         activenicks2 => 30,
         topichistory => 3,
         nicktracking => 0,
-        timeoffset => "+0",
+        charset => 'iso-8859-1',
 
         # Misc settings
 
@@ -190,8 +191,8 @@ sub get_default_config_settings
         # Developer stuff
 
         debug => 0,
-        debugfile => "debug.log",
-        version => "v0.28-cvs",
+        debugfile => 'debug.log',
+        version => 'v0.28-cvs',
     };
 
     # Parse the optional overriden configuration variables

+ 5 - 1
modules/Pisg/HTMLGenerator.pm

@@ -125,6 +125,7 @@ sub _htmlheader
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
 <head>
+<meta http-equiv="Content-Type" content="text/html; charset=$self->{cfg}->{charset}">
 <title>$self->{cfg}->{channel} @ $self->{cfg}->{network} channel statistics</title>
 <style type="text/css">
 a { text-decoration: none }
@@ -1180,7 +1181,7 @@ sub _lasttopics
             $hash{nick} = $nick;
             $hash{time} = "$hour:$min";
             _html("<tr><td bgcolor=\"$self->{cfg}->{hicell}\"><i>$topic</i></td>");
-            _html("<td bgcolor=\"$self->{cfg}->{hicell}\">" . $self->_template_text('bylinetopic', %hash) ."</b></td></tr>");
+            _html("<td bgcolor=\"$self->{cfg}->{hicell}\"><b>" . $self->_template_text('bylinetopic', %hash) ."</b></td></tr>");
         }
         _html("<tr><td align=\"center\" colspan=\"2\" class=\"asmall\">" . $self->_template_text('totaltopic', %hash) . "</td></tr>");
     } else {
@@ -1222,6 +1223,9 @@ sub _template_text
         $text =~ s/å/&aring;/go;
         $text =~ s/æ/&aelig;/go;
         $text =~ s/ø/&oslash;/go;
+        $text =~ s/Å/&Aring;/go;
+        $text =~ s/Æ/&AElig;/go;
+        $text =~ s/Ø/&Oslash;/go;
     }
 
     if ($text =~ /\[:.*?:.*?:\]/o) {