Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/mail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrille Bollu <cyr.debian@bollu.be>2021-02-02 17:29:50 +0300
committerCyrille Bollu <cyr.debian@bollu.be>2021-02-02 17:50:51 +0300
commitea362877b1a25d0272b7a211858e7531cb7d9829 (patch)
tree0c527e58aceff4f2e8188f4656d1bc77f6be5fd0 /lib/Address.php
parentba40c6e1c51e80ff87aa68cd434cb1e6cd40e147 (diff)
Avoids using iconv with '//IGNORE' flag if possible
Signed-off-by: Cyrille Bollu <cyr.debian@bollu.be>
Diffstat (limited to 'lib/Address.php')
-rw-r--r--lib/Address.php6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Address.php b/lib/Address.php
index cfa96169a..119659b27 100644
--- a/lib/Address.php
+++ b/lib/Address.php
@@ -79,6 +79,12 @@ class Address implements JsonSerializable {
return null;
}
// Lets make sure the e-mail is valid UTF-8 at all times
+ // Try a soft conversion first (some installations, eg: Alpine linux,
+ // have issues with the '//IGNORE' option)
+ $utf8 = iconv('UTF-8', 'UTF-8', $email);
+ if ($utf8 !== false) {
+ return $utf8;
+ }
$utf8 = iconv("UTF-8", "UTF-8//IGNORE", $email);
if ($utf8 === false) {
throw new \Exception("Email address <$email> could not be converted via iconv");