Changeset 9969
- Timestamp:
- 2005-05-26T13:31:30+12:00 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/gsprintf.pm
r9362 r9969 102 102 103 103 # If an 8-bit output encoding has been defined, encode the string appropriately 104 return &unicode::unicode2singlebyte(&unicode::utf82unicode($utf8string), $outputencoding); 104 my $encoded=unicode::unicode2singlebyte(&unicode::utf82unicode($utf8string), $outputencoding); 105 106 # If we successfully encoded it, return it 107 if ($encoded) { return $encoded } 108 109 # Otherwise, we can't convert to the requested encoding. return the utf8? 110 $specialoutputencoding='utf8'; 111 return $utf8string; 105 112 } 106 113 … … 123 130 } 124 131 else { 132 # see if there is an encoding set in the appropriate locale env var 133 134 foreach my $envvar ('LC_ALL', 'LANG') { 135 if (!exists $ENV{$envvar}) { next } 136 my $locale=$ENV{$envvar}; 137 if ($locale !~ /^\w+\.(.+)$/) { next } 138 my $enc=lc($1); 139 $enc =~ s/-/_/g; 140 if ($enc eq 'utf_8') { $enc='utf8' } # normalise to this name 141 $specialoutputencoding = $enc; 142 return; 143 } 125 144 $specialoutputencoding = $specialresourcebundle{"{OutputEncoding.unix}"}; 126 145 }
Note:
See TracChangeset
for help on using the changeset viewer.