From 2a6868c85156c17c0cd7ec0c91921446b3097db5 Mon Sep 17 00:00:00 2001 From: David Flatz Date: Mon, 15 Feb 2016 19:10:40 +0100 Subject: if encoding fails (because of broken utf8), use latin1 as input charset; even though its ugly it's still better than empty subjects --- it_mail.class | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'it_mail.class') diff --git a/it_mail.class b/it_mail.class index 6c4398f..503da08 100644 --- a/it_mail.class +++ b/it_mail.class @@ -308,7 +308,9 @@ function header_escape($string) ? ltrim( ($encoded = @iconv_mime_encode('', $string, array('scheme' => 'Q', 'input-charset' => $this->charset, 'output-charset' => $this->charset))) !== false ? $encoded - : iconv_mime_encode('', $string, array('scheme' => 'B', 'input-charset' => $this->charset, 'output-charset' => $this->charset)), + : ($encoded = @iconv_mime_encode('', $string, array('scheme' => 'B', 'input-charset' => $this->charset, 'output-charset' => $this->charset))) !== false + ? $encoded + : iconv_mime_encode('', $string, array('scheme', 'B', 'input-charset' => 'ISO-8859-1', 'output-charset' => $this->charset)), ' :' ) : $string; -- cgit v1.2.3