Changeset 27283

Show
Ignore:
Timestamp:
01.05.2013 18:03:33 (6 years ago)
Author:
ak19
Message:

1. Fixed an encoding bug that Diego helpfully discovered. Metadata extracted from downloaded .oai files were double encoded. This was because we forgot to add a call to decode() after reading in the contents of the oai file, something we had remembered to do in many other plugins. 2. John Thompson recommended the very helpful Dump(dollar-var) function of Devel::Peek which dumps information about any var to stderr, including encoding information. For strings marked utf8 it also prints out hex and octal values for chars outside of Basic Latin.

Files:
1 modified

Legend:

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

    r25333 r27283  
    2727package OAIPlugin; 
    2828 
     29# Devel::Peek's Dump($var) function is useful for debugging encoding issues.  
     30#use Devel::Peek; 
     31use Encode; 
    2932use extrametautil; 
    3033use unicode; 
     
    500503    $self->open_prettyprint_metadata_table(); 
    501504 
     505    # need to decode the string, else it will be double-encoded at this point 
     506    $$textref = decode("utf-8",$$textref); 
     507 
     508# Debugging encoding issues with Devel::Peek's Dump() which prints octal and hexcode 
     509#    print STDERR "#### text ref: $$textref\n"; 
     510#    print STDERR "\n@@@\n"; 
     511#    Dump($$textref); 
     512#    print STDERR "\n"; 
     513 
    502514    if ($$textref =~ m/<metadata\s*>(.*?)<\/metadata\s*>/s) 
    503515    {