Changeset 2237
- Timestamp:
- 2001-04-01T13:21:16+12:00 (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/unicode.pm
r1870 r2237 421 421 } 422 422 423 sub unicode2koi8r { 424 my ($uniref) = @_; 425 426 my $outtext = ""; 427 my $encodename = "unicode-koi8_r"; 428 my $enc_info = $encodings::encodings->{"koi8_r"}; 429 my $mapfile = &util::filename_cat($ENV{'GSDLHOME'}, "mappings", 430 "from_uc", $enc_info->{'mapfile'}); 431 if (!&loadmapencoding ($encodename, $mapfile)) { 432 print STDERR "unicode: ERROR - could not load encoding $encodename\n"; 433 return ""; 434 } 435 436 foreach my $c (@$uniref) { 437 if ($c < 0x80) { 438 # normal ascii character 439 $outtext .= chr($c); 440 } else { 441 # extended ascii character 442 $c = &transchar ($encodename, $c); 443 444 # put a question mark if cannot translate 445 if ($c == 0) { 446 $outtext .= "?"; 447 } else { 448 $outtext .= chr($c); 449 } 450 } 451 } 452 return $outtext; 453 } 454 423 455 1;
Note:
See TracChangeset
for help on using the changeset viewer.