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

office365 search fails with NO [BADCHARSET (US-ASCII)] #145

Open
jmehrens opened this issue Apr 12, 2024 · 0 comments
Open

office365 search fails with NO [BADCHARSET (US-ASCII)] #145

jmehrens opened this issue Apr 12, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@jmehrens
Copy link
Contributor

In testing for #104 I observed that IMAP search in Office365 returns NO [BADCHARSET (US-ASCII)] The specified charset is not supported. This error is reporting that for search only US-ASCII is the only supported charset parameter for search. In JakartaMail, we can set the mail.mime.charset to try to force US-ASCII as the charset used for search but JakartaMail will canonicalize US-ASCII to ISO-8859-1 which is not allowed as the search charset for Office365. The only way to make server side searching in Office365 work would be to set mail.mime.charset=US-ASCII and ship META-INF/javamail.charset.map file that doesn't have the mime2java mapping of us-ascii=ISO-8859-1.

Searching still work (by default) though because AngusMail will fallback to performing the search on the client size by fetching the envelope of every message which is slow.

The changes to explore for this ticket are:

  1. Update IMAPProtocol.searchCharsets array to include an entry for US-ASCII.
  2. SearchQuery doesn't report encoding errors which changes the flow in IMAPFolder. The main issue is that server side search can return zero results but the reason it returned zero results was due to the fact that the bytes generated can't be encoded correctly. Instead an IOException should have been generated. (Move this to a new ticket)
  3. Review the IMAP RFC to see if BADCHARSET response codes have been added to the spec. This would allow us to parse the returned list of supported charsets from a BADCHARSET and add them to the IMAPProtocol.searchCharsets. We could consider doing this anyway if it is not in spec.
@jmehrens jmehrens added the enhancement New feature or request label Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant