From 112dd94dd58e2a4563ee81dc63499633fd776b67 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Tue, 20 Oct 2020 21:27:09 +0200 Subject: [PATCH] Make sure the e-mail is valid UTF-8 Sometimes (I'm looking at you SPAM mails) the e-mail address will contain invalid UTF-8. This will make sure we only return valid UTF-8 by just stripping the invalid parts. Hacky: for sure Works: for me Signed-off-by: Roeland Jago Douma --- lib/Address.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Address.php b/lib/Address.php index aaac62adf1..c45c87d701 100644 --- a/lib/Address.php +++ b/lib/Address.php @@ -66,7 +66,8 @@ public function getLabel(): ?string { * @return string|null */ public function getEmail(): ?string { - return $this->wrapped->bare_address; + // Lets make sure the e-mail is valid UTF-8 at all times + return iconv("UTF-8","UTF-8//IGNORE", $this->wrapped->bare_address); } /**