Changeset 18410
- Timestamp:
- 2009-01-21T19:13:52+13:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/perllib/unicode.pm
r18404 r18410 584 584 if (!&is_url_encoded($text)) { 585 585 $text =~ s/([^A-Z0-9\ \.\-\_])/sprintf("%%%02X", ord($1))/iseg; 586 # return the url-encoded character entity for underscore back to the entity 587 $text =~ s/%26%23095%3B/&\#095;/g; 586 588 } 587 589 return $text; … … 608 610 my ($text) =@_; 609 611 $text =~ s/%25/%/g if &is_url_encoded($text); 612 # DM safing would have replaced underscores with character entity _ 613 # in SourceFile meta. Undo any such change to get the filename referred to. 614 $text =~ s/&\#095;/_/g; 610 615 return $text; 611 616 } 612 617 613 618 # When a filename on the filesystem is already URL-encoded, the 614 # URL to it will have %25s in inplace of every % sign, so that619 # URL to it will have %25s in place of every % sign, so that 615 620 # URLs in html pages can refer to the URL-encoded filename. 616 621 # Given a (URL-encoded) filename on the filesystem, this subroutine … … 631 636 my ($text) = @_; 632 637 if(!&conforms_to_mod_base64($text)) { 638 # return entity for underscore to underscore before encoding 639 $text =~ s/&\#095;/_/g; 640 633 641 $text = &MIME::Base64::encode_base64($text); 634 642 # base64 encoding may introduce + and / signs, … … 663 671 sub conforms_to_mod_base64 { 664 672 my ($text) = @_; 673 674 # need to treat the entity ref for underscore as underscore 675 $text =~ s/&\#095;/_/g; 676 665 677 # base 64 takes alphanumeric and [=+/], 666 678 # but we use modified base64 where + and / are replaced with - and _
Note:
See TracChangeset
for help on using the changeset viewer.