Ignore:
Timestamp:
2010-11-26T09:43:59+13:00 (13 years ago)
Author:
davidb
Message:

Tidy up of debugging statements for handline filename encodings, plus finishing off the 'deduce_filename_encoding' routine

File:
1 edited

Legend:

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

    r23335 r23347  
    379379
    380380    my ($tailname,$dirname) = &File::Basename::fileparse($file);
    381     print STDERR "***!! file = $file\n";
     381
    382382#    my $utf8_file = $self->filename_to_utf8_metadata($file);
    383383#    $utf8_file =~ s/&\#095;/_/g;
    384384    my $utf8_file = &unicode::raw_filename_to_url_encoded($tailname);
    385     print STDERR "***!! utf8_file = $utf8_file\n";
     385
     386    if ((defined $ENV{"DEBUG_UNICODE"}) && ($ENV{"DEBUG_UNICODE"})) {
     387        print STDERR "***!! file = $file\n";
     388        print STDERR "***!! utf8_file = $utf8_file\n";
     389    }
     390
    386391
    387392    my $web_url = "http://";
     
    758763
    759764    # If web page didn't give encoding, then default to utf8
    760     print "*************** looking up $file\n";
     765    if ((defined $ENV{"DEBUG_UNICODE"}) && ($ENV{"DEBUG_UNICODE"})) {
     766        print STDERR "*** Web page didn't give encoding, defaulting to UTF8!\n";
     767        print STDERR "*****  looking up $file\n";
     768    }
    761769
    762770    my $content_encoding= $self->{'content_encoding'} || "utf8";
     
    767775
    768776    &ghtml::urlsafe ($href);
    769     print STDERR "***!!! href=$href\n";   
     777    if ((defined $ENV{"DEBUG_UNICODE"}) && ($ENV{"DEBUG_UNICODE"})) {
     778        print STDERR "***!!! href=$href\n";   
     779    }
     780
    770781
    771782    return $front . "_httpextlink_&rl=" . $rl . "&href=" . $href . $hash_part . $back;
     
    818829    if (!-e $filename) {
    819830    # try the original filename stored in map
    820     print STDERR "***###!! orig filename did not exist: $filename\n";
     831    if ((defined $ENV{"DEBUG_UNICODE"}) && ($ENV{"DEBUG_UNICODE"})) {
     832        print STDERR "***###!! orig filename did not exist: $filename\n";
     833    }
    821834
    822835    my $original_filename = $self->{'utf8_to_original_filename'}->{$utf8_filename};
    823836
    824     print STDERR "**** Trying for $original_filename\n";
     837    if ((defined $ENV{"DEBUG_UNICODE"}) && ($ENV{"DEBUG_UNICODE"})) {
     838        print STDERR "**** Trying for $original_filename\n";
     839    }
    825840
    826841    if (defined $original_filename && -e $original_filename) {
    827         print STDERR "*** found match\n";
     842        if ((defined $ENV{"DEBUG_UNICODE"}) && ($ENV{"DEBUG_UNICODE"})) {
     843            print STDERR "*** found match\n";
     844        }
    828845        $filename = $original_filename;
    829846    }
     
    11641181    $title =~ s/^$self->{'title_sub'}// if ($self->{'title_sub'});
    11651182    $title =~ s/^\s+//s; # in case title_sub introduced any...
    1166     print STDERR "**** adding Title: ", Encode::encode("utf8",$title), "\n";
    11671183    $doc_obj->add_utf8_metadata ($section, "Title", $title);
    11681184    print $outhandle " extracted Title metadata \"$title\" from $from\n"
Note: See TracChangeset for help on using the changeset viewer.