add encoding to the output of the subscription log
This commit is contained in:
parent
b0da792705
commit
5b203e002f
1
README
1
README
|
@ -72,6 +72,7 @@ This version of ezmlm-web requires the following;
|
||||||
+ File::Copy v2.02
|
+ File::Copy v2.02
|
||||||
+ File::Path v1.07
|
+ File::Path v1.07
|
||||||
+ Text::ParseWords v3.24
|
+ Text::ParseWords v3.24
|
||||||
|
+ MIME::QuotedPrint v?
|
||||||
+ Encode (optional)
|
+ Encode (optional)
|
||||||
|
|
||||||
The version number indicates the version of the module that ezmlm-web was
|
The version number indicates the version of the module that ezmlm-web was
|
||||||
|
|
|
@ -28,6 +28,7 @@ use CGI;
|
||||||
use IO::File;
|
use IO::File;
|
||||||
use POSIX;
|
use POSIX;
|
||||||
use English;
|
use English;
|
||||||
|
use MIME::QuotedPrint;
|
||||||
|
|
||||||
# optional modules - they will be loaded later if they are available
|
# optional modules - they will be loaded later if they are available
|
||||||
#Encode
|
#Encode
|
||||||
|
@ -1307,6 +1308,33 @@ sub get_dotqmail_files {
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# check if the input is a quoted string and decode it if necessary
|
||||||
|
# a quoted string could look like the following:
|
||||||
|
# =?ISO-8859-1?Q?S=E9rgio?= <sergio@example.org>
|
||||||
|
# as a regex:
|
||||||
|
# .*=\?ISO-[^\?]+\?Q\?.*\?=.*
|
||||||
|
sub decode_quoted_string {
|
||||||
|
|
||||||
|
my ($input) = @_;
|
||||||
|
my ($pre_text, $post_text, $charset, $encoded, $decoded);
|
||||||
|
|
||||||
|
if ($input =~ m/^(.*)=\?(ISO-[^\?]+)\?Q\?(.*)\?=(.*)$/) {
|
||||||
|
$pre_text = $1;
|
||||||
|
$charset = $2;
|
||||||
|
$encoded = $3;
|
||||||
|
$post_text = $4;
|
||||||
|
# decode the "quoted printable" encoding
|
||||||
|
$decoded = decode_qp($encoded);
|
||||||
|
# try to decode according to the given charset
|
||||||
|
eval { $decoded = Encode::decode($charset, $decoded); };
|
||||||
|
return $pre_text . $decoded . $post_text;
|
||||||
|
} else {
|
||||||
|
return $input;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
sub set_pagedata_subscription_log {
|
sub set_pagedata_subscription_log {
|
||||||
|
|
||||||
my ($listname) = @_;
|
my ($listname) = @_;
|
||||||
|
@ -1335,7 +1363,7 @@ sub set_pagedata_subscription_log {
|
||||||
$epoch_seconds = $1;
|
$epoch_seconds = $1;
|
||||||
$action = $2;
|
$action = $2;
|
||||||
$action_details = $3;
|
$action_details = $3;
|
||||||
$address = $5 ? $5 : $4;
|
$address = decode_quoted_string($5 ? $5 : $4);
|
||||||
$datetext = localtime($epoch_seconds);
|
$datetext = localtime($epoch_seconds);
|
||||||
# the date in gmt format - this should be sufficient
|
# the date in gmt format - this should be sufficient
|
||||||
$pagedata->setValue("Data.List.SubscribeLog.$i.date", $datetext);
|
$pagedata->setValue("Data.List.SubscribeLog.$i.date", $datetext);
|
||||||
|
|
Loading…
Reference in a new issue