diff --git a/README.md b/README.md index 87141f0..bb90917 100644 --- a/README.md +++ b/README.md @@ -5,3 +5,7 @@ This is a collection of tools around (managing) Netnews. ## canlockcheck `canlockcheck.pl` will check whether a given Cancel-Lock and Cancel-Key match. + +## mew + +`mew.pl` will encode or decode MIME encoded words (RFC 2047). diff --git a/mew.pl b/mew.pl new file mode 100644 index 0000000..9cee2f6 --- /dev/null +++ b/mew.pl @@ -0,0 +1,23 @@ +#! /usr/bin/perl -w +# +# mew.pl +# +# converts from and to MIME encoded words +# +# +# Copyright (c) 2023 Thomas Hochstein + +use utf8; +use Encode; +use MIME::QuotedPrint; +use MIME::Base64; + +my $input = join (' ',@ARGV); + +if ($input =~ /[\x80-\x{ffff}]/o) { + print encode('MIME-Q', $input); +} else { + print decode('MIME-Q', $input); +}; + +print "\n";