#!/usr/bin/env perl # Replace malformed data by U+FFFD or '?' (depending on the encoding) # and remove the control characters from U+007F to U+009F. Useful for # MUA's like Mutt, before calling the editor. use strict; use Encode; my $RCSID = '$Id: mkprintable 18116 2007-07-02 19:46:44Z lefevre $'; my ($proc) = $RCSID =~ /^.Id: (\S+) / or die; @ARGV or die "Usage: $proc \n"; my $encoding = shift; while (<>) { $_ = decode($encoding, $_); tr/\x{7F}-\x{9F}//d; print encode($encoding, $_); }