On Donnerstag, 9. Juni 2016 18:37:54 Hans-Peter Jansen wrote:
> On Mittwoch, 8. Juni 2016 10:37:41 R. David Murray wrote:
> > Right, in my previous note I was talking about people not using the
> > new policies.  The compat32 code is probably being used by a lot of
> > people and seems to be working well, including having fixed some header
> > parsing and folding bugs relative to the python2 version of the code.
> 
> FYI, all my reported issues just _vanish_, when using the compat32 policy.
> This apparently makes a _huge_ difference. Probably, using SMTP policy was
> just a unfortunate choice.
> 
> I'm back to regenerating all mails with the compat32 policy now (after
> adding a SMTP logging module for critical conditions ;) ).
> 
> Let's see, how this goes.

Hmm, compat32 and Python3 start to get in my way in no funny ways.

As David implied already, the encoding dance is necessary for compat32.
Since my app is a simple postfix filter, I have no way of controlling, how it 
is executed. "Of course", it is executed in the POSIX locale (LANG=C), which 
is, as I have learned now, one of the weakest spots of Python3 itself, when it 
comes to the default filesystem encoding.

Needless to say, my filter acts on regex pattern for subjects, attachments and 
the like, that contain utf-8 literals.

If I read the bugs http://bugs.python.org/issue19846, 
https://bugs.python.org/issue19847, and a couple of others correctly, there's 
no way to supply a different filesystem encoding without control of the 
environment variables.

Hence, with Python3, I have three choices: 
 * patch postfix to provide a proper locale
 * patch Python3 to force a certain locale, if setup is broken, e.g.:
   http://bugs.python.org/file24064//tmp/filesystem_encoding_utf8.patch
 * change _all_ filesystem operations to catch UnicodeEncodeError and encode
   manually, which are a lot.

These options are awful. Altogether. Am I missing something (again)?

Cheers,
Pete
_______________________________________________
Email-SIG mailing list
Email-SIG@python.org
Your options: 
https://mail.python.org/mailman/options/email-sig/archive%40mail-archive.com

Reply via email to