Changeset 16918 for gsdl/trunk/perllib/unicode.pm
- Timestamp:
- 2008-08-20T17:32:04+12:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/perllib/unicode.pm
r16913 r16918 596 596 } 597 597 598 # When a filename on the filesystem is already URL-encoded, the 599 # URL to it will have %25s in in place of every % sign, so that 600 # URLs in html pages can refer to the URL-encoded filename. 601 # This method changes the URL reference back into the actual 602 # (URL-encoded) filename on the filesystem by replacing %25 with %. 603 sub url_to_filename { 604 my ($text) =@_; 605 $text =~ s/%25/%/g; 606 } 607 608 # When a filename on the filesystem is already URL-encoded, the 609 # URL to it will have %25s in in place of every % sign, so that 610 # URLs in html pages can refer to the URL-encoded filename. 611 # Given a (URL-encoded) filename on the filesystem, this subroutine 612 # returns the URL reference string for it by replacing % with %25. 613 # The output string will be the same as the input string if the input 614 # already contains one or more %25s. This is to prevent processing 615 # a url more than once this way. 616 sub filename_to_url { 617 my ($text) =@_; 618 619 if($text !~ m/%25/) { 620 $text =~ s/%/%25/g; 621 } 622 } 623 624 598 625 sub substr 599 626 {
Note:
See TracChangeset
for help on using the changeset viewer.