Changeset 16935
- Timestamp:
- 2008-08-21T11:53:55+12:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/perllib/plugins/HTMLPlugin.pm
r16920 r16935 619 619 my $utf8_link = ""; 620 620 $self->decode_text($link,$encoding,$language,\$utf8_link); 621 ### my $utf8_url_encoded_link = &unicode::url_encode($utf8_link);622 621 623 622 $self->{'utf8_to_original_filename'}->{$utf8_link} = $url_original_filename; 624 ### $self->{'utf8_to_original_filename'}->{$utf8_url_encoded_link} = $url_original_filename; 625 626 # print STDERR "**** Storing block link: $link\n"; 627 # print STDERR "**** URL original filename: $url_original_filename\n"; 628 print STDERR "**** utf8_encoded_link to original src filename:\n\t$utf8_link\n\t".$self->{'utf8_to_original_filename'}->{$utf8_link}."\n"; 623 # print STDERR "**** utf8_encoded_link to original src filename:\n\t$utf8_link\n\t".$self->{'utf8_to_original_filename'}->{$utf8_link}."\n"; 629 624 630 625 $block_hash->{'file_blocks'}->{$url_original_filename} = 1; … … 707 702 # links, so even if 'file_is_url' is off, still need to store info 708 703 709 # print STDERR "#### file: $file\n";710 711 704 my ($tailname,$dirname,$suffix) = &File::Basename::fileparse($file, "\\.[^\\.]+\$"); 712 705 my $utf8_file = $self->filename_to_utf8_metadata($file); … … 719 712 $web_url = $web_url.$utf8_file; 720 713 } 721 # print STDERR "#### weburl: $web_url\n";722 714 723 715 $doc_obj->add_utf8_metadata($cursection, "URL", $web_url); … … 1004 996 my $img_file = $self->add_file ($href, $rl, $hash_part, $base_dir, $doc_obj, $section); 1005 997 1006 # print STDERR "**** link = $link\n"; 1007 # print STDERR "**** href = $href\n"; 1008 # print STDERR "**** img_file = $img_file\n"; 998 # print STDERR "**** link = $link\n**** href = $href\n**** img_file = $img_file\n"; 1009 999 1010 1000 my $anchor_name = $img_file; … … 1050 1040 # This is more complicated than it sounds when char encodings 1051 1041 # is taken in to account 1052 ## &unicode::ensure_utf8(\$link);1053 ## $link = &unicode::url_encode($link);1054 # print STDERR "#### filepath: ".&util::filename_cat($base_dir,$file)."\n";1055 # print STDERR "#### link: $link\n";1056 1057 1042 my ($href, $hash_part, $rl) = $self->format_link ($link, $base_dir, $file); 1058 # print STDERR "#### href: $href\n";1059 1043 1060 1044 # href may use '\'s where '/'s should be on Windows 1061 1045 $href =~ s/\\/\//g; 1062 1063 ## $href = &unicode::url_decode($href);1064 # print STDERR "#### href again: $href\n";1065 1046 my ($filename) = $href =~ m/^(?:.*?):(?:\/\/)?(.*)/; 1066 1047 … … 1105 1086 1106 1087 $filename = &util::filename_cat($base_dir, $filename); 1107 # print STDERR "**** filename: $filename\n";1108 1088 # Replace %XX's in URL with decoded value if required. Note that the filename may include the %XX in some 1109 1089 # situations. If the *original* file's name was in URL encoding, the following method will not decode it. 1110 1090 my $utf8_filename = $filename; 1111 # print STDERR "*** filename before URL decoding: $filename\n";1112 1091 $filename = $self->opt_url_decode($utf8_filename); 1113 # print STDERR "*** filename after URL decoding: $filename\n\n";1114 1092 1115 1093 # some special processing if the intended filename was converted to utf8, but … … 1118 1096 # try the original filename stored in map 1119 1097 my $original_filename = $self->{'utf8_to_original_filename'}->{$filename}; 1120 # print STDERR "*** missing: $filename" unless defined $original_filename; #StrangeNoGraphicData in word doc1121 1098 if (defined $original_filename && -e $original_filename) { 1122 1099 $filename = $original_filename; … … 1156 1133 ($newname) = $utf8_filename =~ m/([^\/\\]*)$/; 1157 1134 } 1158 # print STDERR "Before url encoding newname: $newname\n"; 1135 1159 1136 # Make sure this name uses only ASCII characters 1160 1137 # => use URL encoding, as it preserves original encoding 1161 1138 $newname = &unicode::url_encode($newname); 1162 # print STDERR "After url encoding newname: $newname\n";1163 # print STDERR "*** Real name and converted filename:\n\t$filename\n\t$newname\n";1164 1139 1165 1140 $doc_obj->associate_file($filename, $newname, undef, $section); … … 1253 1228 $before_hash = &util::filename_cat($dirname, $before_hash); 1254 1229 $before_hash = $self->eval_dir_dots($before_hash); 1255 1256 # print STDERR "#### before_hash: $before_hash\n";1257 1230 } 1258 1231
Note:
See TracChangeset
for help on using the changeset viewer.