Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #51474

Re: [python] email 8bit encoding

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <wking@tremily.us>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'subject:: [': 0.04; 'encoded': 0.07; 'utf-8': 0.07; '[1]:': 0.09; '[2]:': 0.09; 'url:github': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; '8-bit': 0.16; '[2].': 0.16; 'charset,': 0.16; 'cleaner': 0.16; 'fallback': 0.16; 'filename:fname piece:signature': 0.16; 'gnupg': 0.16; 'how,': 0.16; 'received:76.96': 0.16; 'received:mail.comcast.net': 0.16; 'url:general': 0.16; 'url:gmane': 0.16; 'url:thread': 0.16; 'subject:python': 0.16; 'url:org)': 0.16; 'wrote:': 0.18; 'subject:] ': 0.20; 'cc:addr:python.org': 0.22; 'header:User-Agent:1': 0.23; 'module,': 0.24; 'received:comcast.net': 0.24; 'cheers,': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'signed': 0.27; 'header:In-Reply-To:1': 0.27; 'asked': 0.31; 'url:wiki': 0.31; '-0700,': 0.31; 'url:wikipedia': 0.31; 'figure': 0.32; 'url:python': 0.33; 'except': 0.35; 'something': 0.35; 'but': 0.35; 'charset:us-ascii': 0.36; 'url:org': 0.36; 'received:76': 0.38; 'information,': 0.61; 'back': 0.62; 'content- disposition:inline': 0.62; 'email addr:yahoo.com': 0.64; 'more': 0.64; 'here': 0.66; 'response.': 0.68; 'jul': 0.74; 'to:addr:yahoo.com': 0.81; ':).': 0.84; 'trevor': 0.84; 'url:master': 0.84; '8bit': 0.91; 'encrypted': 0.91; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/simple; d=tremily.us; s=odin; t=1375078573; bh=AFjbhItJcsd9aiv9zBHkQYMBZKm9WReLLp4AR8Pz90E=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=AYNX/+deWAdczs+D5CvT+mpWHr7nwKZgXeJ0xolnwi53XuIlnUnICvThGhyUFCOYn H6/6CDRyct3oKLyqxm/ElcURlHIySVyFyy7ue3w0lKXdJXGagPq9AE0ilDrXwwlEKL OvgfQ4oPAy/XBJaYJ8lFA1uSYSLoSqlhPWFDG3oc=
Date Sun, 28 Jul 2013 23:16:12 -0700
From "W. Trevor King" <wking@tremily.us>
To rurpy@yahoo.com
Subject Re: [python] email 8bit encoding
References <36aa5535-a821-4d7e-8414-1e40820705e4@googlegroups.com>
MIME-Version 1.0
Content-Type multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="k1lZvvs/B4yU6o8G"
Content-Disposition inline
In-Reply-To <36aa5535-a821-4d7e-8414-1e40820705e4@googlegroups.com>
OpenPGP id=39A2F3FA2AB17E5D8764F388FC29BDCDF15F5BE8; url=http://tremily.us/pubkey.txt
User-Agent Mutt/1.5.21 (2010-09-15)
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20121106; t=1375124639; bh=Zxr86oK6LtW7FmWhumV2VDMVlzD0m/tUywcB0MsZ9Yg=; h=Received:Received:Received:Date:From:To:Subject:Message-ID: MIME-Version:Content-Type; b=U2UocdCioiHMvOjTTVIyEHq4qIbQAvvNvipCeQFlK4AslsbQQBydx+IMUGH1sskF2 kM9eINAwtK/7porF0k4Os+xW5LZcvlUgyGGm5raAhtFRmnxMthGBpfnYOCmrf4nYXa dLtlYi3/nwlXeCN3hQa+lGg5dE8oFBGn7TaInF3JQjJ8dQsFmP89xDeZpr+MNKUfdY V/qDI63K4as79pN2vCY4xRWxVKyROEyJVI92WqvScLE8r4DAbtEKoKtXw9GwZBmITB fcgeFj3zrC3V900uzqFiDx3dDfHNZwVBrBa6Cn0sEHq7CTJizQ+EzhraflSU/VbThO 1tE65xo2Q/9yA==
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.5252.1375124803.3114.python-list@python.org> (permalink)
Lines 54
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1375124803 news.xs4all.nl 15923 [2001:888:2000:d::a6]:33671
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:51474

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

On Sun, Jul 28, 2013 at 04:41:27PM -0700, rurpy@yahoo.com wrote:
> How, using Python-3.3's email module, do I "flatten" (I think
> that's the right term) a Message object to get utf-8 encoded
> body with the headers:
>  Content-Type: text/plain; charset=UTF-8
>  Content-Transfer-Encoding: 8bit
> when the message payload was set to a python (unicode) string?

I asked about this a while back [1], but never got a response.  My
current best-guess is here [2].  My fallback flattening works for
everything except the 8-bit encoded messages using the UTF-16 charset,
but it's pretty ugly.

Let me know if you figure out something cleaner :).

Cheers,
Trevor

[1]: http://thread.gmane.org/gmane.comp.python.general/725425
[2]: https://github.com/wking/rss2email/blob/master/rss2email/email.py#L226

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

email 8bit encoding rurpy@yahoo.com - 2013-07-28 16:41 -0700
  Re: [python] email 8bit encoding "W. Trevor King" <wking@tremily.us> - 2013-07-28 23:16 -0700
    Re: [python] email 8bit encoding rurpy@yahoo.com - 2013-07-29 20:56 -0700
  Re: email 8bit encoding Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-07-29 22:52 +0200
    Re: email 8bit encoding rurpy@yahoo.com - 2013-08-01 08:20 -0700
      Re: email 8bit encoding Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-08-02 13:19 +0200
      Re: email 8bit encoding Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-08-02 14:12 +0200

csiph-web