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 |
|
|
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 |
|
|
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}) && |
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 |
|
|