1 # encodings.pl - Download IANA text and compute alias list.
2 # Assumes you are running this program from gnu/gcj/convert/.
3 # Output suitable for direct inclusion in IOConverter.java.
5 # Map IANA canonical names onto our canonical names.
7 'ANSI_X3.4-1968' => 'ASCII',
8 'ISO_8859-1:1987' => '8859_1',
10 'Shift_JIS' => 'SJIS',
11 'Extended_UNIX_Code_Packed_Format_for_Japanese' => 'EUCJIS'
16 $file = 'character-sets';
19 # Too painful to figure out how to get Perl to do it.
20 system 'wget -o .wget-log http://www.isi.edu/in-notes/iana/assignments/character-sets';
28 open (INPUT
, "< $file") || die "couldn't open $file: $!";
35 $body = 1 if /^Name:/;
44 ($type, $name) = split (/\s+/);
47 $current = $map{$name};
50 print " hash.put (\"$name\", \"$current\");\n";
53 elsif ($type eq 'Alias:')
55 # The IANA list has some ugliness.
56 if ($name ne '' && $name ne 'NONE' && $current)
58 print " hash.put (\"$name\", \"$current\");\n";