Ignore:
Timestamp:
2010-11-26T12:09:53+13:00 (13 years ago)
Author:
davidb
Message:

More careful use of encoding parameter to $self->set_Source_metadata so it reflects the *filename* encoding that Greenstone has worked out, not the encoding for the *content* of the file, which of course could be completely different!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/plugins/ReadXMLFile.pm

    r20830 r23349  
    213213    $self->{'filename_no_path'} = $filename_no_path;
    214214    $self->{'processor'} = $processor;
     215
    215216    # this contains metadata passed in from running metadata_read with other plugins (eg from MetadataXMLPlugin)
    216217    # we are also using it to store up any metadata found during parsing the XML, so that it can be added to the doc obj.
     
    368369    my $self = shift(@_);
    369370
     371    my $metadata = $self->{'metadata'};
     372
    370373    # create a new document
    371     $self->{'doc_obj'} = new doc ($self->{'filename'}, "indexed_doc", $self->{'file_rename_method'});
    372     $self->{'doc_obj'}->add_utf8_metadata($self->{'doc_obj'}->get_top_section(), "Plugin", "$self->{'plugin_type'}");
    373     $self->set_Source_metadata($self->{'doc_obj'}, $self->{'filename_no_path'});
    374    
    375 
     374    my $doc_obj = $self->{'doc_obj'} = new doc ($self->{'filename'}, "indexed_doc", $self->{'file_rename_method'});
     375
     376    $doc_obj->add_utf8_metadata($doc_obj->get_top_section(), "Plugin", "$self->{'plugin_type'}");
     377
     378    my $filename_no_path = $self->{'filename_no_path'};
     379    my $plugin_filename_encoding = $self->{'filename_encoding'};
     380    my $filename_encoding = $self->deduce_filename_encoding($filename_no_path,$metadata,$plugin_filename_encoding);
     381
     382    $self->set_Source_metadata($doc_obj, $filename_no_path, $filename_encoding);
     383   
    376384    # do we want other auto metadata here (see BasePlugin.read_into_doc_obj)
    377385}
Note: See TracChangeset for help on using the changeset viewer.