From 2cdaa79dce689b2dc9ef5c7bf3dcbd9446d86c21 Mon Sep 17 00:00:00 2001
From: Paweł Słowik <pawel.slowik@iq.pl>
Date: Thu, 13 Sep 2012 08:24:01 -0400
Subject: [PATCH] Merge branch 'master' of https://github.com/roundcube/roundcubemail
---
program/include/rcube_imap.php | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index 66b5c4b..0b2f84d 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -1434,6 +1434,12 @@
$criteria = 'UNDELETED '.$criteria;
}
+ // unset CHARSET if criteria string is ASCII, this way
+ // SEARCH won't be re-sent after "unsupported charset" response
+ if ($charset && $charset != 'US-ASCII' && is_ascii($criteria)) {
+ $charset = 'US-ASCII';
+ }
+
if ($this->threading) {
$threads = $this->conn->thread($folder, $this->threading, $criteria, true, $charset);
@@ -1465,7 +1471,7 @@
}
$messages = $this->conn->search($folder,
- ($charset ? "CHARSET $charset " : '') . $criteria, true);
+ ($charset && $charset != 'US-ASCII' ? "CHARSET $charset " : '') . $criteria, true);
// Error, try with US-ASCII (some servers may support only US-ASCII)
if ($messages->is_error() && $charset && $charset != 'US-ASCII') {
--
Gitblit v1.9.1