New submission from Eduard Bopp <eduard.b...@aepsil0n.de>:

Using email.policy.SMTP a message's non-ASCII characters are not encoded. The 
policy.utf8 attribute is set to False as documented.

The attached script illustrates the behaviour. I get the following command line 
output from it:

Subject: =?utf-8?b?w7zDtsOk?=


False
Subject: üöä


True
Subject: üöä


The default compat32 policy encodes the string, but the SMTP policy does not 
encode it, but leaves it as UTF-8 despite policy.utf8 == False. I might be 
misreading the documentation here, but it seems to me like utf8 == False 
implies that encoding should happen.

----------
components: email
files: minimal.py
messages: 365596
nosy: aepsil0n, barry, r.david.murray
priority: normal
severity: normal
status: open
title: SMTP email policy does not encode non-ASCII characters
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8
Added file: https://bugs.python.org/file49026/minimal.py

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

Reply via email to