Warn of unencoded 8bit characters in header or body if -d is set.

Signed-off-by: Thomas Hochstein <thh@thh.name>
This commit is contained in:
Thomas Hochstein 2026-02-07 19:20:10 +01:00
parent 1e7bccbbec
commit cc881f7897
2 changed files with 11 additions and 0 deletions

View file

@ -430,6 +430,16 @@ sub BuildPosting {
# add User-Agent
push @Headers, "User-Agent: $NAME/$VERSION\n";
# check for unencoded 8bit characters in header or body in --debug mode
# taken from tinews.pl
if ($Config{'debug'}) {
print "- Raw 8-bit data in headers.\n" if (grep {/[\x80-\xff]/} @Headers);
# check for MIME headers and warn for 8bit characters in body if missing
if (!defined($Header{'mime-version'}) || !defined($Header{'content-type'})) {
print "- 8bit data in body without MIME-headers.\n" if (grep {/[\x80-\xff]/} @Body);
}
}
# parse pseudo headers from body
my ($InRealBody,$LastModified,$PostingFrequency);
foreach (@Body) {