/[wopi]/make_poll.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /make_poll.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.20 by dpavlin, Sat Nov 8 22:42:18 2003 UTC revision 1.21 by dpavlin, Tue Apr 13 15:11:58 2004 UTC
# Line 9  Line 9 
9  use strict;  use strict;
10    
11  use XML::Parser;  use XML::Parser;
 use common;  
12  use Carp;  use Carp;
13    use Text::Iconv;
14    
15  $|=1;  $|=1;
16    
# Line 108  my $q_db_col = "q"; Line 108  my $q_db_col = "q";
108  # for unnumbered questions  # for unnumbered questions
109  my $u_db_col = "u";  my $u_db_col = "u";
110    
111    # output encoding for files, probably defined in header.html also
112    my $html_encoding="ISO-8859-2";
113    
114    Text::Iconv->raise_error(1);    # Conversion errors raise exceptions
115    my $iconv;
116    
117    # convert UTF8 (as from XML file) to 8-bit encoding
118    sub x {
119            if (! $iconv) {
120                    $iconv = Text::Iconv->new('UTF8', $html_encoding);
121                    print "output encoding is $html_encoding\n";
122            }
123            return $iconv->convert($_[0]);
124    }
125    
126    1;
127    
128  #------------------------------------------------------------------  #------------------------------------------------------------------
129    
# Line 911  sub config { Line 927  sub config {
927    
928          $$ncref = sub {          $$ncref = sub {
929                  my ($xp, $text) = @_;                  my ($xp, $text) = @_;
930                    # encoding should be checked first since it also
931                    # initialize iconv for conversion from XML's UTF-8
932                    $html_encoding=$attref->{html_encoding} if ($attref->{html_encoding});
933                  $db_user=x($attref->{db_user});                  $db_user=x($attref->{db_user});
934                  $prefix=x($attref->{prefix});                  $prefix=x($attref->{prefix});
935                  $without_invitation=x($attref->{without_invitation}) &&                  $without_invitation=x($attref->{without_invitation}) &&
# Line 929  sub config { Line 948  sub config {
948                  $q_db_col=x($attref->{q_db_col}) || 'q';                  $q_db_col=x($attref->{q_db_col}) || 'q';
949                  $u_db_col=x($attref->{u_db_col}) || 'u';                  $u_db_col=x($attref->{u_db_col}) || 'u';
950    
951    
952          }          }
953  }  }
954    

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.21

  ViewVC Help
Powered by ViewVC 1.1.26