💾 Archived View for bbs.geminispace.org › s › misfin › 17946 captured on 2024-06-16 at 19:41:28. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
Misfin reference server crashes when mail is sent containing unicode in the name or body of the message and the recipient is using MailDir or MH.
Error ultimately comes from Python itself. The mailbox module is not Unicode safe and leads to a crash:
File "/email/generator.py", line 410, in write
self._fp.write(s.encode('ascii', 'surrogateescape'))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)
Appears it may work if you are using gembox storage. Not sure if it's the default. I don't think it was because failure to delivery unicode is what started this search.
The failure is silent and only appears in the logs.
2 hours ago · 🤔 1
God only knows how you get whoever is maintaining the Python module to fix it, and then you have to wait for that fix to propogate.
This presents a few problems:
You don't know if your recipient is using MH/MailDir, your server reports successful delivery, their server never tells them there was an error.
Even if you want to restore communication, there is no way to change your sender name at the moment if your sender name contains unicode.
It might be best to remove MH/MailDir support until these libraries are fixed, or else write an inbound preprocessor to fix unicode senders/messages in some way that allows delivery through the existing module.
Steps to duplicate:
1. Create misfin user
2. Log in with certificate
3. Change to MH or MailDir in settings (one of these may be default)
4. On a second server, compose a mail to your new user
5. For the message string, use the text "代码错误"
6. Examine syslog for the error after your message does not arrive