Changeset 24193
- Timestamp:
- 2011-06-22T18:31:37+12:00 (12 years ago)
- Location:
- main/trunk/greenstone2/perllib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/classify/BaseClassifier.pm
r23116 r24193 56 56 use printusage; 57 57 use parse2; 58 use unicode; 58 59 59 60 # suppress the annoying "subroutine redefined" warning that various … … 278 279 279 280 delete $self->{"info_only"}; 281 # user-entered UTF-8 display meta for buttonname. Needs to be internally turned into unicode 282 # (will later be turned back to UTF-8 along with the rest of the metadata) 283 if ($self->{'buttonname'}) { 284 $self->{'buttonname'} = &unicode::convert_utf8_string_to_unicode_string($self->{'buttonname'}); 285 } 280 286 return bless $self, $class; 281 287 } … … 369 375 } 370 376 377 371 378 # ex. can be at front, or it may be a list of metadata, separated by ,/; 372 379 sub strip_ex_from_metadata { -
main/trunk/greenstone2/perllib/classify/List.pm
r24147 r24193 680 680 681 681 682 sub convert_utf8_string_to_unicode_string683 {684 my $self = shift(@_);685 my $utf8_string = shift(@_);686 687 my $unicode_string = "";688 foreach my $unicode_value (@{&unicode::utf82unicode($utf8_string)}) {689 $unicode_string .= chr($unicode_value);690 }691 return $unicode_string;692 }693 694 695 sub convert_unicode_string_to_utf8_string696 {697 my $self = shift(@_);698 my $unicode_string = shift(@_);699 700 my @unicode_array;701 for (my $i = 0; $i < length($unicode_string); $i++) {702 push(@unicode_array, ord(substr($unicode_string, $i, 1)));703 }704 return &unicode::unicode2utf8(\@unicode_array);705 }706 707 708 682 sub generate_partition_start 709 683 { -
main/trunk/greenstone2/perllib/unicode.pm
r23831 r24193 848 848 849 849 850 sub convert_utf8_string_to_unicode_string 851 { 852 my $utf8_string = shift(@_); 853 854 my $unicode_string = ""; 855 foreach my $unicode_value (@{&unicode::utf82unicode($utf8_string)}) { 856 $unicode_string .= chr($unicode_value); 857 } 858 return $unicode_string; 859 } 860 861 sub convert_unicode_string_to_utf8_string 862 { 863 my $unicode_string = shift(@_); 864 865 my @unicode_array; 866 for (my $i = 0; $i < length($unicode_string); $i++) { 867 push(@unicode_array, ord(&substr($unicode_string, $i, 1))); 868 } 869 return &unicode::unicode2utf8(\@unicode_array); 870 } 871 872 850 873 1;
Note:
See TracChangeset
for help on using the changeset viewer.