diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Commands/Messages.php b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Commands/Messages.php index d83fb5ff4..ad8d8ab53 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Commands/Messages.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Commands/Messages.php @@ -384,14 +384,17 @@ trait Messages * @throws \MailSo\Net\Exceptions\* * @throws \MailSo\Imap\Exceptions\* */ - public function MessageSimpleESearch(string $sSearchCriterias = 'ALL', array $aSearchReturn = null, bool $bReturnUid = true, string $sCharset = '', string $sLimit = '') : array + public function MessageSimpleESearch(string $sSearchCriterias = 'ALL', array $aSearchReturn = null, bool $bReturnUid = true, string $sLimit = '') : array { $oESearch = new \MailSo\Imap\Requests\ESEARCH($this); $oESearch->sCriterias = $sSearchCriterias; $oESearch->aReturn = $aSearchReturn; $oESearch->bUid = $bReturnUid; $oESearch->sLimit = $sLimit; - $oESearch->sCharset = $sCharset; +// if (!$this->UTF8Mode() && !\mb_check_encoding($sSearchCriterias, 'UTF-8')) { + if (!$this->UTF8Mode() && !\MailSo\Base\Utils::IsAscii($sSearchCriterias)) { + $oESearch->sCharset = 'UTF-8'; + } $oESearch->SendRequest(); return $this->getSimpleESearchOrESortResult($bReturnUid); } @@ -420,12 +423,13 @@ trait Messages * @throws \MailSo\Net\Exceptions\* * @throws \MailSo\Imap\Exceptions\* */ - public function MessageSimpleSearch(string $sSearchCriterias = 'ALL', bool $bReturnUid = true, string $sCharset = '') : array + public function MessageSimpleSearch(string $sSearchCriterias = 'ALL', bool $bReturnUid = true) : array { $aRequest = array(); - if (\strlen($sCharset)) { +// if (!$this->UTF8Mode() && !\mb_check_encoding($sSearchCriterias, 'UTF-8')) { + if (!$this->UTF8Mode() && !\MailSo\Base\Utils::IsAscii($sSearchCriterias)) { $aRequest[] = 'CHARSET'; - $aRequest[] = \strtoupper($sCharset); + $aRequest[] = 'UTF-8'; } $aRequest[] = !\strlen($sSearchCriterias) || '*' === $sSearchCriterias ? 'ALL' : $sSearchCriterias; diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php index 078c91940..0e7a1c747 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php @@ -49,6 +49,9 @@ class ImapClient extends \MailSo\Net\NetClient private bool $bIsLoggined = false; + /** + * RFC 6855 UTF8 mode + */ private bool $UTF8 = false; public function Hash() : string @@ -685,5 +688,4 @@ class ImapClient extends \MailSo\Net\NetClient { return $this->UTF8 ? $sText : \MailSo\Base\Utils::Utf7ModifiedToUtf8($sText); } - } diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php b/snappymail/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php index f5ee87a96..e097d87af 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php @@ -607,8 +607,8 @@ class MailClient $aResultUids = $this->oImapClient->MessageSimpleSort($aSortTypes, $sSearchCriterias, $bReturnUid); } else { // $this->oImapClient->hasCapability('ESEARCH') -// $aResultUids = $this->oImapClient->MessageSimpleESearch($sSearchCriterias, null, $bReturnUid, \MailSo\Base\Utils::IsAscii($sSearchCriterias) ? '' : 'UTF-8') - $aResultUids = $this->oImapClient->MessageSimpleSearch($sSearchCriterias, $bReturnUid, \MailSo\Base\Utils::IsAscii($sSearchCriterias) ? '' : 'UTF-8'); +// $aResultUids = $this->oImapClient->MessageSimpleESearch($sSearchCriterias, null, $bReturnUid) + $aResultUids = $this->oImapClient->MessageSimpleSearch($sSearchCriterias, $bReturnUid); } if ($bUseCacheAfterSearch) {