Changeset 11262 for trunk


Ignore:
Timestamp:
2006-02-16T10:18:26+13:00 (18 years ago)
Author:
mdewsnip
Message:

The FDT file wasn't being read using the encoding specified, so things would go bad if there were non-ASCII characters in the field names.

File:
1 edited

Legend:

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

    r10254 r11262  
    141141
    142142    # Parse the associated ISIS database Field Definition Table file (.fdt)
    143     my %fdtmapping = &parse_field_definition_table($fdtfilename);
     143    my %fdtmapping = &parse_field_definition_table($fdtfilename, $encoding);
    144144
    145145    # Map the tag numbers to tag names, using the FDT mapping
     
    252252{
    253253    my $fdtfilename = shift(@_);
     254    my $encoding = shift(@_);
    254255
    255256    my %fdtmapping = ();
     
    257258    open(FDT_FILE, "<$fdtfilename") || die "Error: Could not open file $fdtfilename.\n";
    258259
     260    my $fdtfiletext = "";
     261    my $reader = new multiread();
     262    $reader->set_handle('ISISPlug::FDT_FILE');
     263    $reader->set_encoding($encoding);
     264    $reader->read_file($fdtfiletext);
     265
    259266    my $amongstdefinitions = 0;
    260     foreach my $fdtfileline (<FDT_FILE>) {
     267    foreach my $fdtfileline (split(/\n/, $$fdtfiletext)) {
    261268    $fdtfileline =~ s/(\s*)$//;  # Remove any nasty spaces at the end of the lines
    262269
     
    271278
    272279        # Map from tag number to metadata field title and subfields
    273         my $fieldtag = (split(/ /, $fieldspecs))[0];
     280        my ($fieldtag) = ($fieldspecs =~ /^\s*(\d+)\s+/);
    274281        $fdtmapping{$fieldtag} = { 'title' => $fieldtitle,
    275282                       'subfields' => $fieldsubfields };
Note: See TracChangeset for help on using the changeset viewer.