last changes; completly broken charsets
[webpac] / all2xml.pl
index ddb64be..66fb8aa 100755 (executable)
@@ -78,7 +78,7 @@ sub isis2xml {
 
                my $swish_data = "";
                my $display_data = "";
-               my $line_delimiter = "";
+               my $line_delimiter;
 
                my ($swish,$display);
 
@@ -103,13 +103,13 @@ sub isis2xml {
                        ($s,$d,$i) = (0,0,1) if (lc($x->{type}) eq "index");
 #print STDERR "## s: $s d: $d i: $i ## $format ##\n";  
 
-                       if ($x->{append}) {
+                       # what will separate last line from this one?
+                       if ($display_data && $x->{append} && $x->{append} eq "1") {
                                $line_delimiter = ' ';
-                       } else {
+                       } elsif ($display_data) {
                                $line_delimiter = '<br/>';
                        }
 
-                       $display_data .= $line_delimiter if ($display_data && $display);
                        # init vars so that we go into while...
                        ($swish,$display) = (1,1);
 
@@ -138,6 +138,10 @@ sub isis2xml {
 
                                # type="display" ; field for display
                                if ($d && $display) {
+                                       if ($line_delimiter && $display_data) {
+                                               $display_data .= $line_delimiter;
+                                               undef $line_delimiter;
+                                       }
                                        if ($filter) {
                                                no strict 'refs';
                                                $display_data .= join($delimiter,&$filter($display));
@@ -169,10 +173,7 @@ sub isis2xml {
 #print STDERR "s_d: $swish_data\nd_d: $display_data\n" if ($swish_data);
                if ($display_data) {
 
-                       # remove last <br>
-                       $display_data =~ s/$line_delimiter$//;
-
-                       $display_data = $isis_codepage->convert($display_data) || die "Can't convert '$display_data' !";
+#                      $display_data = $isis_codepage->convert($display_data) || die "Can't convert '$display_data' !";
                        # FIX: this is removed and replaced by html tag.
                        #$xml .= xmlify($field."_display", $display_data);
 
@@ -193,7 +194,6 @@ sub isis2xml {
                                }
                                if ($field_name) {
                                        $html .= $xml_codepage->convert($field_name);
-#                                      $html .= "-->".$field_name."<--";
                                }
                                $html .= $display_data."###\n";
                        }
@@ -274,6 +274,7 @@ foreach my $database ($cfg->Sections) {
 
                        if (my $xml = isis2xml($row,$add_xml)) {
 #print STDERR "--ret-->$xml\n";
+                               use bytes;      # as opposed to chars
                                print "Path-Name: $path#".int($row->{mfn})."\n";
                                print "Content-Length: ".(length($xml)+1)."\n";
                                print "Document-Type: XML\n\n$xml\n";