<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Extract on Bas-Man's Musings</title><link>https://bas-man.dev/tags/extract/</link><description>Recent content in Extract on Bas-Man's Musings</description><generator>Hugo</generator><language>en</language><lastBuildDate>Mon, 02 Nov 2020 18:30:45 +0900</lastBuildDate><atom:link href="https://bas-man.dev/tags/extract/index.xml" rel="self" type="application/rss+xml"/><item><title>Decoding Email Header and Contents</title><link>https://bas-man.dev/cheatsheets/python/snippets/email-header-subject/</link><pubDate>Thu, 15 Oct 2020 09:59:45 +0900</pubDate><guid>https://bas-man.dev/cheatsheets/python/snippets/email-header-subject/</guid><description>&lt;script src="https://gist.github.com/Bas-Man/7c7a6c9a7c141033063efc879d5be46e.js"&gt;&lt;/script&gt;

&lt;p&gt;Using &lt;code&gt;email.parser&lt;/code&gt; and &lt;code&gt;email.policy&lt;/code&gt; along with &lt;code&gt;policy.default&lt;/code&gt; means that
you do not need to worry about character encoding as the modules will take care
of it automatically.&lt;/p&gt;
&lt;p&gt;I forget where I saw it but I believe that policy.default will become the real
default in the future.&lt;br&gt;
Current &lt;code&gt;policy.compat32&lt;/code&gt; is the module default.&lt;/p&gt;</description></item></channel></rss>