This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tanzer@swing.co.at
Recipients r.david.murray, tanzer@swing.co.at
Date 2015-11-04.09:04:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <E1ZttzW-0007UN-LZ@swing.co.at>
In-reply-to Your message of "Tue, 03 Nov 2015 19:59:53 +0000" <1446580793.55.0.26948453162.issue25545@psf.upfronthosting.co.za>
Content
R. David Murray wrote at Tue, 03 Nov 2015 19:59:53 +0000:

>  Your problem is that your input email is ia unicode string.  A unicode
>  string has no RFC defintion as an email, so things do not work right,
>  as you observed.  Whether or not email should throw an error when fed
>  a non-ascii unicode string is an interesting question, but it hasn't
>  in the past and so for backward compatibility reasons we won't change
>  that.

Excuse me, I am using `email.message_from_string` which is documented
to convert a unicode string to an email object. If you are serious
`message_from_string` should not even exist! As long as it is there
and documented as::

  email.message_from_string(s, _class=email.message.Message, *, policy=policy.compat32)

    Return a message object structure from a string. This is exactly
    equivalent to Parser().parsestr(s). _class and policy are
    interpreted as with the Parser class constructor.

    Changed in version 3.3: Removed the strict argument. Added the
    policy keyword.

your argument is unfounded and this is definitely a serious bug!

> You might also be interested in the newer email API, currently
> documented in the 'contentmanager' and 'policy' chapters of the
> documentation.  It says it is provisional, but the changes (other than
> bug fixes) between the current API and what will be final in 3.6 are
> trivial.

I'm using Python 2.7 and only just exploring 3.5.

Unfortunately, there are many bugs and your response is a typical
example why moving from 2.7 to 3.x is hard.

There is gratuitous breakage but the reaction is::

    resolution:  -> not a bug

I would ask you to reconsider that stance.

As long as my code needs to support 2.7, use of any new API doesn't
fly. After an eventual switch to 3.5 (probably years in the future), I
might use new APIs for new code but changing existing code that used
to work won't be in the cards

> get_content_charset is None because you don't have any actual headers
> in your message, just body.  This is because of the leading newline in
> your triple quoted string, which the email package takes as the end of
> the headers.

Thanks for the hint. BTW, removing the leading newline doesn't change
the buggy behavior of `message_from_string`!
History
Date User Action Args
2015-11-04 09:04:29tanzer@swing.co.atsetrecipients: + r.david.murray
2015-11-04 09:04:29tanzer@swing.co.atlinkissue25545 messages
2015-11-04 09:04:28tanzer@swing.co.atcreate