From 73edf89a10976a0200c71ec6e17a22900bb8d1a6 Mon Sep 17 00:00:00 2001 From: mguessan Date: Mon, 24 Oct 2011 22:45:57 +0000 Subject: [PATCH] IMAP: fix 3426383, implement CHARSET in SEARCH command, allow ASCII and UTF-8 git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1826 3d1905a2-6b24-0410-a738-b14d5a86fcbd --- src/java/davmail/imap/ImapConnection.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/java/davmail/imap/ImapConnection.java b/src/java/davmail/imap/ImapConnection.java index a7032794..83b60258 100644 --- a/src/java/davmail/imap/ImapConnection.java +++ b/src/java/davmail/imap/ImapConnection.java @@ -63,7 +63,7 @@ public class ImapConnection extends AbstractConnection { * @param clientSocket IMAP client socket */ public ImapConnection(Socket clientSocket) { - super(ImapConnection.class.getSimpleName(), clientSocket, null); + super(ImapConnection.class.getSimpleName(), clientSocket, "UTF-8"); } @Override @@ -878,6 +878,11 @@ public class ImapConnection extends AbstractConnection { condition = session.or(); } else if (token.startsWith("OR ")) { condition = appendOrSearchParams(token, conditions); + } else if ("CHARSET".equals(token)) { + String charset = tokens.nextQuotedToken().toUpperCase(); + if (!("ASCII".equals(charset) || "UTF-8".equals(charset))) { + throw new IOException("Unsupported charset "+charset); + } } else { if (condition == null) { condition = session.and();