Changeset 28782


Ignore:
Timestamp:
01/15/14 14:11:21 (7 years ago)
Author:
ak19
Message:

Routine for reading in text files failed to 'decode' from UTF-8 to trigger Unicode aware strings. Methods changed to user Superclass to ensure this is now done consitently

Location:
main/trunk/greenstone2/perllib/plugins
Files:
2 edited

Legend:

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

    r24794 r28782  
    9494    my $self = shift (@_);
    9595    my ($filename, $encoding, $language, $textref) = @_;
    96     my $outhandle = $self->{'outhandle'};
    9796
    98     # Read the CSV file content
    99     open(FILE, $filename);
    100     my $reader = new multiread();
    101     $reader->set_handle('CSVPlugin::FILE');
    102     $reader->set_encoding($encoding);
    103     $reader->read_file($textref);
    104     close(FILE);
     97    # Read in file the usual ReadTextFile way
     98    # This ensure that $textref is a unicode aware string
     99    $self->SUPER::read_file(@_);
     100
     101    #
     102    # Now top-up the processing of the text with what this plugin
     103    # needs
     104    #
    105105
    106106    # Remove any blank lines so the data is split and processed properly
  • main/trunk/greenstone2/perllib/plugins/TabSeparatedPlugin.pm

    r28669 r28782  
    9696    my $self = shift (@_);
    9797    my ($filename, $encoding, $language, $textref) = @_;
    98     my $outhandle = $self->{'outhandle'};
    9998
    100     # Read the Tab-separated file content
    101     open(FILE, $filename);
    102     my $reader = new multiread();
    103     $reader->set_handle('TabSeparatedPlugin::FILE');
    104     $reader->set_encoding($encoding);
    105     $reader->read_file($textref);
    106     close(FILE);
     99    # Read in file the usual ReadTextFile way
     100    # This ensure that $textref is a unicode aware string
     101    $self->SUPER::read_file(@_);
     102
     103    #
     104    # Now top-up the processing of the text with what this plugin
     105    # needs
     106    #
    107107
    108108    # Remove any blank lines so the data is split and processed properly
Note: See TracChangeset for help on using the changeset viewer.