Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong charset used in creating search terms when server supports UTF8 #607

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2476,7 +2476,7 @@ private int[] search(String msgSequence, SearchTerm term)
// is not allowed; see RFC 6855, section 3, last paragraph)
if (supportsUtf8() || SearchSequence.isAscii(term)) {
try {
return issueSearch(msgSequence, term, null);
return issueSearch(msgSequence, term, supportsUtf8() ? StandardCharsets.UTF_8.name() : null);
} catch (IOException ioex) { /* will not happen */ }
}

Expand Down Expand Up @@ -2537,7 +2537,7 @@ private int[] issueSearch(String msgSequence, SearchTerm term,

Response[] r;

if (charset == null) // text is all US-ASCII
if (charset == null || (StandardCharsets.UTF_8.name().equalsIgnoreCase(charset) && supportsUtf8())) // text is all US-ASCII
r = command("SEARCH", args);
else
r = command("SEARCH CHARSET " + charset, args);
Expand Down