Sam Varshavchik <sam.varshavc...@gmail.com> added the comment:

I don't have sufficient python or imaplib exposure to be able to implement full 
UTF8 APPEND functionality. I was merely investigating and researching what IMAP 
UTF8 support there was, in all existing client and server code I knew of.

What I can propose is to reverse this part of the original change:

@@ -360,7 +380,10 @@
             date_time = Time2Internaldate(date_time)
         else:
             date_time = None
-        self.literal = MapCRLF.sub(CRLF, message)
+        literal = MapCRLF.sub(CRLF, message)
+        if self.utf8_enabled:
+            literal = b'UTF8 (' + literal + b')'
+        self.literal = literal
         return self._simple_command(name, mailbox, flags, date_time)

I don't see that the original patch added any code to test_imaplib.py to test 
UTF8 literals with APPEND. So what this should do is, is go back and use the 
pre-UTF8, RFC 3501 APPEND syntax, with no existing unit test fall-out.

Which is fine. IMAP UTF8 clients are not required to use UTF8 literals with 
APPEND. Enabling UTF8 in the IMAP server does not require using the UTF8 
version of APPEND. It's only required if the IMAP client wishes to send a 
message with UTF8 headers to the IMAP server.

I also looked into mutt's source, and mutt appears to be taking the same 
approach. It enables UTF8 mode in the IMAP server, and swallows UTF8 E-mail, 
and deals with folders whose names are now encoded in UTF8, instead of RFC3501 
IMAP's modified-UTF7 encoding convention. But I did not see anything in mutt 
that used UTF8 literals with APPEND. Searching mutt's source for APPEND code 
finds only one instance which sends the non-UTF8 literal. Looks like mutt will 
accept UTF8 mail, but not generate them itself. Not sure what mutt does 
creating a reply to E-mail with a UTF8 E-mail address. I don't use mutt, but 
I'll test that.

It does not surprise me, that this did not come up previously. All three other 
Libre IMAP server that I know of: UW-IMAP, Cyrus, and Dovecot, do not implement 
RFC 6855. Unless one of them is currently working on it, Courier will be the 
first one to support it. But, I have other sources that confirm otherwise.

I fully understand your lack of interest in imaplib (I really do), and I wish I 
had more Python background to help out here, myself. This is as much as I can 
propose right now, with some level of confidence in my meager Python skills. I 
mostly revolve in C++, C, and Perl orbits.

If in the future more interest develops in improving IMAP support, I'm 
reachable and I'll be open to integration testing as much as my own time 
permits, in these matters...

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34138>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to