#!/usr/local/bin/perl # Translates MIME 8bit or quoted-printable messages into the old # GAELIC-L convention of a slash after the vowel. # # 1996-11-06, Michael Fromberger (Michael.J.Fromberger@dartmouth.edu) # # ISOASC is a translation table for the conventional Gaelic vowel # orthography used on the GAELIC-L list. Other translations could be # added or substituted # %ISOASC = ( "0xF2" => "o\\", "0xF3" => "o/", "0xC8" => "E\\", "0xC9" => "E/", "0xE8" => "e\\", "0xD9" => "U\\", "0xE9" => "e/", "0xF9" => "u\\", "0xDA" => "U/", "0xCC" => "I\\", "0xFA" => "u/", "0xCD" => "I/", "0xEC" => "i\\", "0xED" => "i/", "0xC0" => "A\\", "0xC1" => "A/", "0xE0" => "a\\", "0xE1" => "a/", "0xD2" => "O\\", "0xD3" => "O/", ); while(<>) { last if /^$/; if(/^Content-type.*text\/plain.*8859/i) { print "Content-Type: text/plain; charset=\"us-ascii\"\n"; next; } if(/^Content-transfer-encoding.*/i) { print "Content-Transfer-Encoding: 7bit\n"; $QP = 1 if /quoted-printable/i; next; } print; } while(<>) { if($QP) { s/=([0-9A-Fa-f][0-9A-Fa-f])/chr(hex($1))/ge; # Translate QP to 8-bit } @ch = split(//, $_); for($i = 0; $i <= $#ch; $i++) { $ch[$i] = sprintf("0x%02X", ord $ch[$i]); $ch[$i] = $ISOASC{$ch[$i]} || chr(oct($ch[$i])); } $_ = join('', @ch); print; }