2025-05-18 16:22:24 +02:00
|
|
|
#! /usr/bin/perl -w
|
|
|
|
|
#
|
|
|
|
|
# mew.pl
|
|
|
|
|
#
|
|
|
|
|
# converts from and to MIME encoded words
|
|
|
|
|
#
|
|
|
|
|
#
|
|
|
|
|
# Copyright (c) 2023 Thomas Hochstein <thh@thh.name>
|
|
|
|
|
|
|
|
|
|
use utf8;
|
2026-05-30 12:07:58 +02:00
|
|
|
use open qw(:std :encoding(UTF-8));
|
2025-05-18 16:22:24 +02:00
|
|
|
use Encode;
|
|
|
|
|
use MIME::QuotedPrint;
|
|
|
|
|
use MIME::Base64;
|
|
|
|
|
|
|
|
|
|
my $input = join (' ',@ARGV);
|
2026-05-30 12:07:58 +02:00
|
|
|
utf8::decode($input);
|
2025-05-18 16:22:24 +02:00
|
|
|
|
|
|
|
|
if ($input =~ /[\x80-\x{ffff}]/o) {
|
2026-05-30 12:48:59 +02:00
|
|
|
$output = encode('MIME-Q', $input);
|
|
|
|
|
$output =~ s/=20/_/g;
|
2025-05-18 16:22:24 +02:00
|
|
|
} else {
|
2026-05-30 12:48:59 +02:00
|
|
|
$output = decode('MIME-Q', $input);
|
2025-05-18 16:22:24 +02:00
|
|
|
};
|
|
|
|
|
|
2026-05-30 12:48:59 +02:00
|
|
|
print "$output\n";
|