mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-28 02:37:16 +00:00
Search UTF-8
This commit is contained in:
parent
1c3e2170fc
commit
60bbea131a
1 changed files with 13 additions and 1 deletions
|
@ -718,7 +718,14 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
||||||
Argument args = ss.generateSequence(terms, utf8 ? StandardCharsets.UTF_8.name() : null);
|
Argument args = ss.generateSequence(terms, utf8 ? StandardCharsets.UTF_8.name() : null);
|
||||||
args.writeAtom("ALL");
|
args.writeAtom("ALL");
|
||||||
|
|
||||||
Response[] responses = protocol.command("SEARCH", args); // no CHARSET !
|
// https://www.rfc-editor.org/rfc/rfc3501#section-6.4.4
|
||||||
|
Response[] responses = protocol.command("SEARCH" + (utf8 ? " CHARSET UTF-8" : ""), args);
|
||||||
|
if (responses != null && responses.length > 0 && !responses[responses.length - 1].isOK()) {
|
||||||
|
// Normally "NO"
|
||||||
|
if (!BuildConfig.PLAY_STORE_RELEASE)
|
||||||
|
Log.e(responses[responses.length - 1].toString());
|
||||||
|
responses = protocol.command("SEARCH", args);
|
||||||
|
}
|
||||||
if (responses == null || responses.length == 0)
|
if (responses == null || responses.length == 0)
|
||||||
throw new ProtocolException("No response from server");
|
throw new ProtocolException("No response from server");
|
||||||
for (Response response : responses)
|
for (Response response : responses)
|
||||||
|
@ -1045,6 +1052,11 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
||||||
search = Normalizer
|
search = Normalizer
|
||||||
.normalize(search, Normalizer.Form.NFKD)
|
.normalize(search, Normalizer.Form.NFKD)
|
||||||
.replaceAll("[^\\p{ASCII}]", "");
|
.replaceAll("[^\\p{ASCII}]", "");
|
||||||
|
if (TextUtils.isEmpty(search)) {
|
||||||
|
String msg = "Cannot convert to ASCII: " + query;
|
||||||
|
Log.e(msg);
|
||||||
|
throw new IllegalArgumentException(msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> word = new ArrayList<>();
|
List<String> word = new ArrayList<>();
|
||||||
|
|
Loading…
Reference in a new issue