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/PagedImagePlugin.pm

    r22814 r23349  
    316316
    317317    #process the .item file
    318     $doc_obj = $self->process_item($filename_full_path, $dir, $file, $processor);
     318    $doc_obj = $self->process_item($filename_full_path, $dir, $file, $processor, $metadata);
    319319   
    320320    }
     
    513513    $self->{'doc_obj'} = new doc ($self->{'filename'}, "indexed_doc", $self->{'file_rename_method'});
    514514    # TODO is file filenmae_no_path??
    515     $self->set_initial_doc_fields($self->{'doc_obj'}, $self->{'file'}, $self->{'processor'});
     515    $self->set_initial_doc_fields($self->{'doc_obj'}, $self->{'file'}, $self->{'processor'}, $self->{'metadata'});
    516516
    517517    my ($dir, $file) = $self->{'filename'} =~ /^(.*?)([^\/\\]*)$/;
     
    540540sub set_initial_doc_fields {
    541541    my $self = shift(@_);
    542     my ($doc_obj, $filename_no_path, $processor) = @_;
     542    my ($doc_obj, $filename_no_path, $processor, $metadata) = @_;
    543543
    544544    my $topsection = $doc_obj->get_top_section();
     
    552552    }
    553553
    554     $self->set_Source_metadata($doc_obj, $filename_no_path);
     554    my $plugin_filename_encoding = $self->{'filename_encoding'};
     555    my $filename_encoding = $self->deduce_filename_encoding($filename_no_path,$metadata,$plugin_filename_encoding);
     556    $self->set_Source_metadata($doc_obj, $filename_no_path, $filename_encoding);
    555557   
    556558    # if we want a header page, we need to add some text into the top section, otherwise this section will become invisible
     
    615617sub process_item {
    616618    my $self = shift (@_);
    617     my ($filename_full_path, $dir, $filename_no_path, $processor) = @_;
     619    my ($filename_full_path, $dir, $filename_no_path, $processor, $metadata) = @_;
    618620
    619621    my $doc_obj = new doc ($filename_full_path, "indexed_doc", $self->{'file_rename_method'});
    620     $self->set_initial_doc_fields($doc_obj, $filename_no_path, $processor);
     622    $self->set_initial_doc_fields($doc_obj, $filename_no_path, $processor, $metadata);
    621623    my $topsection = $doc_obj->get_top_section();
    622624    open (ITEMFILE, $filename_full_path) || die "couldn't open $filename_full_path\n";
Note: See TracChangeset for help on using the changeset viewer.