1
0
mirror of https://github.com/freescout-helpdesk/freescout.git synced 2025-01-31 12:01:39 +01:00

Fix accents and special characters removed from new customer names - closes #4506

This commit is contained in:
FreeScout 2025-01-23 22:58:43 -08:00
parent 2d821be5e1
commit 29491f663f
4 changed files with 25 additions and 2 deletions

View File

@ -1036,6 +1036,12 @@ class Mail
*/
public static function decodeSubject($subject)
{
// Sometimes trying to decode non-encoded strings leads
// to loosing accents.
// https://github.com/freescout-help-desk/freescout/issues/4506
if (!strstr($subject, '=?')) {
return $subject;
}
// Remove new lines as iconv_mime_decode() may loose a part separated by new line:
// =?utf-8?Q?Gesch=C3=A4ftskonto?= erstellen =?utf-8?Q?f=C3=BCr?=
// 249143

View File

@ -710,6 +710,19 @@ class Header {
if (!property_exists($address, 'personal')) {
$address->personal = false;
} else {
// $personalParts = $this->mime_header_decode($address->personal);
// if (is_array($personalParts)) {
// $address->personal = '';
// foreach ($personalParts as $p) {
// $address->personal .= $this->convertEncoding($p->text, $this->getEncoding($p));
// }
// }
// if (strpos($address->personal, "'") === 0) {
// $address->personal = str_replace("'", "", $address->personal);
// }
$personal_slices = explode(" ", $address->personal);
$address->personal = "";
foreach ($personal_slices as $slice) {

View File

@ -1,4 +1,4 @@
From: from@there.com
From: =?UTF-8?Q?An=C3=A1lisis_EC_Madrid?= <analisismadrid@xxx.org>
To: to@here.com
Subject: =?ISO-2022-JP?B?GyRCIXlCaBsoQjEzMhskQjlmISEhViUsITwlRyVzGyhCJhskQiUoJS8lOSVGJWolIiFXQGxMZ0U5JE4kPyRhJE4jURsoQiYbJEIjQSU1JW0lcyEhIVo3bjQpJSglLyU5JUYlaiUiISYlbyE8JS8hWxsoQg==?=
Date: Wed, 13 Sep 2017 13:05:45 +0200

View File

@ -42,6 +42,11 @@ class WebklexMessage1Test extends FixtureWebklexMessage {
$attachment = $attachments->first();
self::assertSame("☆第132号 「ガーデン&エクステリア」専門店のためのQ&Aサロン 【月刊エクステリア・ワーク】", $attachment->filename);
self::assertSame("☆第132号 「ガーデン&エクステリア」専門店のためのQ&Aサロン 【月刊エクステリア・ワーク】", $attachment->name);
// https://github.com/freescout-help-desk/freescout/issues/4506
$from = $message->getFrom();
self::assertSame(1, count($from->get()));
self::assertSame('Análisis EC Madrid', $from[0]->personal);
}
/**
@ -96,5 +101,4 @@ class WebklexMessage1Test extends FixtureWebklexMessage {
// self::assertSame("Checkliste 10.,DAVIDGASSE 76-80;2;2.pdf", $attachment->name);
self::assertSame("Checkliste 10.,DAVIDGASSE 76-80;2;2.pdf", $attachment->filename);
}
}