Changeset 31419
- Timestamp:
- 2017-02-16T14:34:57+13:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/gsprintf.pm
r27306 r31419 30 30 @gsprintf::ISA=qw(Exporter); 31 31 32 use Encode; 33 32 34 use unicode; 33 35 use util; … … 87 89 } 88 90 91 89 92 90 93 sub lookup_string 91 94 { 92 my ($stringkey) = @_; 95 my ($stringkey, $native_perl) = @_; 96 97 if (!defined $native_perl || $native_perl != 1) { 98 $native_perl = 0; 99 } 93 100 return "" unless defined $stringkey; 94 101 # Try the language-specific resource bundle first … … 119 126 } 120 127 121 # Return the string matching the key 122 return $utf8string if (!defined($outputencoding) || $outputstringsinUTF8 123 || $outputencoding eq "utf8"); 124 128 if ($native_perl ==1) { 129 # decode the utf8 string to perl internal format 130 return decode("utf8", $utf8string); 131 } 132 133 # Return the utf8 string if our output encoding is utf8 134 if (!defined($outputencoding) || $outputstringsinUTF8 135 || $outputencoding eq "utf8") { 136 return $utf8string; 137 } 138 125 139 # If an 8-bit output encoding has been defined, encode the string appropriately 126 140 my $encoded=unicode::unicode2singlebyte(&unicode::utf82unicode($utf8string), $outputencoding);
Note:
See TracChangeset
for help on using the changeset viewer.