
while(<>) {
   s/([\200-\376])(.)/sprintf("\\%o\\%o",ord($1),ord($2))/ego;
   s/\033\$.[^\033]*\033\(./&convert($&)/ego;
   print;
}

sub convert {
   $tmp = $_[0];
   $tmp=~s/./sprintf("\\%o",ord($&))/ego;
   return $tmp;
}
