Changeset 33757 for main/trunk/greenstone2/perllib/unicode.pm
- Timestamp:
- 2019-12-07T01:40:13+13:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/unicode.pm
r33299 r33757 697 697 } 698 698 699 # Base64 encoding does not encode a pure ASCII to itself. This is important to know. 700 # If the $force_encode parameter is true, then this method WILL base64 encode whatever 701 # string is passed in, including any plain ASCII string. 702 # That means this method could double encode an already encoded string. 703 # However, this method is necessary because on the GLI end, we can't detect whether a plain 704 # ASCII string has been encoded or not. And if gsdlsourcefilerenamemethod is set to base64, 705 # then gli will always attempt to decode all parts of the relative path gsdlsourcefilename 706 # (except the "import" prefix, which is special) or none of the parts. 707 sub force_base64_encode { 708 my ($text) = @_; 709 my $force_encode = 1; 710 return &base64_encode($text, $force_encode); 711 } 712 699 713 sub base64_encode { 700 my ($text ) = @_;701 if( !&conforms_to_mod_base64($text)) {714 my ($text, $force_encode) = @_; 715 if($force_encode || !&conforms_to_mod_base64($text)) { 702 716 # return entity for underscore to underscore before encoding 703 717 $text =~ s/&\#095;/_/g;
Note:
See TracChangeset
for help on using the changeset viewer.