Changeset 88 for trunk


Ignore:
Timestamp:
1998-12-21T15:16:15+13:00 (26 years ago)
Author:
rjmcnab
Message:

Special characters are now escaped in GML files.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/perllib/plugins/GMLPlug.pm

    r75 r88  
    2525    return 0; # this is not a recursive plugin
    2626}
     27
     28sub _unescape_text {
     29    my ($text) = @_;
     30
     31    # special characters in the gml encoding
     32    $text =~ s/&lt;/</g;
     33    $text =~ s/&gt;/>/g;
     34    $text =~ s/&quot;/\"/g;
     35    $text =~ s/&amp;/&/g; # this has to be last...
     36
     37    return $text;
     38}
     39
    2740
    2841# return 1 if processed, 0 if not processed
     
    6376        my $tags = $1;
    6477        $tags = "" unless defined $tags;
    65         my $text = $2;
     78        my $text = &_unescape_text($2);
    6679
    6780        # create the section (unless this is the first section)
     
    7992        # add the tags
    8093        while ((defined $tags) && ($tags =~ s/^\s*(\w+)\s*=\s*\"([^\"]*)\"//)) {
    81         $doc_obj->add_utf8_metadata($section, $1 , $2) if (defined $1 and defined $2);
     94        $doc_obj->add_utf8_metadata($section, $1 , &_unescape_text($2))
     95            if (defined $1 and defined $2);
    8296        }
    8397
    8498        # add the text
    85         $doc_obj->add_utf8_text($section, $text) if ((defined $text) && ($text ne ""));
     99        $doc_obj->add_utf8_text($section, $text)
     100        if ((defined $text) && ($text ne ""));
    86101
    87102    } elsif ($gml =~ s/^\s*<\/gsdlsection>//) {
Note: See TracChangeset for help on using the changeset viewer.