From fcf1faa41c25637e3e339fa3c9b3b52a66b0af0a Mon Sep 17 00:00:00 2001 From: Thomas Hochstein Date: Sun, 18 May 2025 16:22:24 +0200 Subject: [PATCH] Add mew.pl Signed-off-by: Thomas Hochstein --- README.md | 4 ++++ mew.pl | 23 +++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 mew.pl 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";