#!/usr/bin/perl -w
# -*- coding: iso-8859-3 -*-

while (<>){
  my ($root, $flags) = split('/',$_);
  # Process roots
  next if $root =~ /\\o/;
  $root =~ s/\^c/æ/g;
  $root =~ s/\^C/Æ/g;
  $root =~ s/\^g/ø/g;
  $root =~ s/\^G/Ø/g;
  $root =~ s/\^h/¶/g;
  $root =~ s/\^H/¦/g;
  $root =~ s/\^j/¼/g;
  $root =~ s/\^J/¬/g;
  $root =~ s/\^s/þ/g;
  $root =~ s/\^S/Þ/g;
  $root =~ s/\^u/ý/g;
  $root =~ s/\^U/Ý/g;
  # Some words in eo.dic are written in TeX encoding. Convert to latin3
  $root =~ s/\\"u/ü/g;
  $root =~ s/\\c\{c\}/ç/g;
  $root =~ s/\\'a/á/g;
  if ( $flags ){
    # Process flags
    $flags =~ s/\\/!/;      # Rename flag '\' to '! for aspell benefit'
    print join ('/', $root, $flags);
  } else {
    print $root;
  }
}
