diff -uNr mailwatch-1.2.0-beta-4.orig/mailscanner/detail.php mailwatch-1.2.0-beta-4/mailscanner/detail.php
--- mailwatch-1.2.0-beta-4.orig/mailscanner/detail.php 2012-04-24 14:15:18.000000000 +0200
+++ mailwatch-1.2.0-beta-4/mailscanner/detail.php 2012-08-03 16:41:10.740215753 +0200
@@ -184,6 +184,13 @@
}
if ($fieldn == "Subject:") {
$row[$f] = decode_header($row[$f]);
+ if (function_exists (mb_check_encoding)) {
+ if (! mb_check_encoding ($row[$f], 'UTF-8')) {
+ $row[$f] = mb_convert_encoding($row[$f], 'UTF-8');
+ }
+ } else {
+ $row[$f] = utf8_encode ($row[$f]);
+ }
$row[$f] = htmlspecialchars($row[$f]);
}
if ($fieldn == "Spam Report:") {
diff -uNr mailwatch-1.2.0-beta-4.orig/mailscanner/functions.php mailwatch-1.2.0-beta-4/mailscanner/functions.php
--- mailwatch-1.2.0-beta-4.orig/mailscanner/functions.php 2012-04-24 14:15:18.000000000 +0200
+++ mailwatch-1.2.0-beta-4/mailscanner/functions.php 2012-08-03 16:41:10.742216284 +0200
@@ -1612,7 +1612,14 @@
$row[$f] = str_replace(",","
",$row[$f]);
break;
case 'subject':
- $row[$f] = utf8_encode(decode_header($row[$f]));
+ $row[$f] = decode_header($row[$f]);
+ if (function_exists (mb_check_encoding)) {
+ if (! mb_check_encoding ($row[$f], 'UTF-8')) {
+ $row[$f] = mb_convert_encoding($row[$f], 'UTF-8');
+ }
+ } else {
+ $row[$f] = utf8_encode($row[$f]);
+ }
$row[$f] = htmlspecialchars($row[$f]);
if(SUBJECT_MAXLEN>0) {
$row[$f] = trim_output($row[$f], SUBJECT_MAXLEN);
diff -uNr mailwatch-1.2.0-beta-4.orig/mailscanner/viewmail.php mailwatch-1.2.0-beta-4/mailscanner/viewmail.php
--- mailwatch-1.2.0-beta-4.orig/mailscanner/viewmail.php 2012-04-24 14:15:18.000000000 +0200
+++ mailwatch-1.2.0-beta-4/mailscanner/viewmail.php 2012-08-03 16:41:10.743237411 +0200
@@ -130,12 +130,40 @@
// Display the headers
switch(true) {
case isset($structure->headers['date']):
+ if (function_exists (mb_check_encoding)) {
+ if ( ! mb_check_encoding ($structure->headers['date'], 'UTF-8')) {
+ $structure->headers['date'] = mb_convert_encoding($structure->headers['date'], 'UTF-8');
+ }
+ } else {
+ $structure->headers['date'] = utf8_encode ($structure->headers['date']);
+ }
lazy("Date:",$structure->headers['date']);
case isset($structure->headers['from']):
+ if (function_exists (mb_check_encoding)) {
+ if ( ! mb_check_encoding ($structure->headers['from'], 'UTF-8')) {
+ $structure->headers['from'] = mb_convert_encoding($structure->headers['from'], 'UTF-8');
+ }
+ } else {
+ $structure->headers['from'] = utf8_encode ($structure->headers['from']);
+ }
lazy("From:",str_replace('"','',$structure->headers['from']));
case isset($structure->headers['to']):
+ if (function_exists (mb_check_encoding)) {
+ if ( ! mb_check_encoding ($structure->headers['to'], 'UTF-8')) {
+ $structure->headers['to'] = mb_convert_encoding($structure->headers['to'], 'UTF-8');
+ }
+ } else {
+ $structure->headers['to'] = utf8_encode ($structure->headers['to']);
+ }
lazy("To:",str_replace('"','',$structure->headers['to']));
case isset($structure->headers['subject']):
+ if (function_exists (mb_check_encoding)) {
+ if ( ! mb_check_encoding ($structure->headers['subject'], 'UTF-8')) {
+ $structure->headers['subject'] = mb_convert_encoding ($structure->headers['subject'], 'UTF-8');
+ }
+ } else {
+ $structure->headers['subject'] = utf8_encode ($structure->headers['subject']);
+ }
lazy("Subject:",$structure->headers['subject']);
}
diff -uNr mailwatch-1.2.0-beta-4.orig/mailscanner/viewpart.php mailwatch-1.2.0-beta-4/mailscanner/viewpart.php
--- mailwatch-1.2.0-beta-4.orig/mailscanner/viewpart.php 2012-04-24 14:15:18.000000000 +0200
+++ mailwatch-1.2.0-beta-4/mailscanner/viewpart.php 2012-08-03 16:41:10.744244827 +0200
@@ -101,6 +101,9 @@
$type = $structure->ctype_primary."/".$structure->ctype_secondary;
switch($type) {
case "text/plain":
+ if (isset ($structure->ctype_parameters['charset']) && strtolower($structure->ctype_parameters['charset']) == 'utf-8') {
+ $structure->body = utf8_decode ($structure->body);
+ }
echo '