Skip to content

Support UTF8=ACCEPT (RFC 9755) #311

@artob

Description

@artob

Gmail advertises the UTF8=ACCEPT server capability defined in RFC 9755:

S: * CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 UIDPLUS COMPRESS=DEFLATE ENABLE MOVE CONDSTORE ESEARCH UTF8=ACCEPT LIST-EXTENDED LIST-STATUS LITERAL- SPECIAL-USE APPENDLIMIT=35651584

Enabling this client capability is simple enough (BTW, all protocol output here is from session.debug = true):

session.run_command_and_check_ok("ENABLE UTF8=ACCEPT")?;
C: a3 ENABLE UTF8=ACCEPT
S: * ENABLED UTF8=ACCEPT
S: a3 OK Success

After enabling the client capability, server responses now contain pure, sweet UTF-8 without any further batshit crazy legacy encoding:

# Without UTF8=ACCEPT
S: * 13 FETCH (UID 222 ENVELOPE ("Fri, 13 Jun 2025 16:40:17 +0000" "=?UTF-8?Q?=F0=9F=99=8C_Complete_your_sign_up_to_ASIMOV.Blog!?=" (("ASIMOV.Blog" NIL "asimov-blog" "ghost.io")) ((NIL NIL "asimov-blog" "ghost.io")) ((NIL NIL "noreply" "asimov-blog.ghost.io")) ((NIL NIL "arto" "asimov.systems")) NIL NIL NIL "<[email protected]>"))
# With UTF8=ACCEPT
S: * 13 FETCH (UID 222 ENVELOPE ("Fri, 13 Jun 2025 16:40:17 +0000" "🙌 Complete your sign up to ASIMOV.Blog!" (("ASIMOV.Blog" NIL "asimov-blog" "ghost.io")) ((NIL NIL "asimov-blog" "ghost.io")) ((NIL NIL "noreply" "asimov-blog.ghost.io")) ((NIL NIL "arto" "asimov.systems")) NIL NIL NIL "<[email protected]>"))

However, something in this crate is not quite ready for this straightforward UTF-8 world, and the connection gets closed after receiving the first ENVELOPE with UTF-8 data (#71?):

S: * 13 FETCH (UID 222 ENVELOPE ("Fri, 13 Jun 2025 16:40:17 +0000" "🙌 Complete your sign up to ASIMOV.Blog!" (("ASIMOV.Blog" NIL "asimov-blog" "ghost.io")) ((NIL NIL "asimov-blog" "ghost.io")) ((NIL NIL "noreply" "asimov-blog.ghost.io")) ((NIL NIL "arto" "asimov.systems")) NIL NIL NIL "<[email protected]>"))
Error: Bye(Bye { information: "no explanation given", code: None })

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions