Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: UNSURE 0.221 X-Spam-Level: ** X-Spam-Evidence: '*H*': 0.69; '*S*': 0.13; 'encoded': 0.07; 'utf-8': 0.07; 'python': 0.11; 'how,': 0.16; 'trying': 0.19; 'header:User- Agent:1': 0.23; 'module,': 0.24; 'header:In-Reply-To:1': 0.27; '3.2': 0.31; 'skip:m 30': 0.32; 'could': 0.34; 'test': 0.35; 'but': 0.35; 'to:addr:python-list': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'email addr:yahoo.com': 0.64; 'pardon': 0.84; 'received:195.238': 0.84; 'received:195.238.6': 0.84; 'received:belgacom.be': 0.84; 'received:isp.belgacom.be': 0.84; '8bit': 0.91 X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhIDANLU9lFbtq+i/2dsb2JhbAANToZUqHaSGQQEAYEwgxkBAQQ4QBELIRYPCQMCAQIBMxIQAwYCAod6A6YyikyIB40VgSmBRhaDcQOVeoFljCaIPIFv Date: Mon, 29 Jul 2013 22:52:04 +0200 From: Antoon Pardon User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130704 Icedove/17.0.7 MIME-Version: 1.0 To: python-list@python.org Subject: Re: email 8bit encoding References: <36aa5535-a821-4d7e-8414-1e40820705e4@googlegroups.com> In-Reply-To: <36aa5535-a821-4d7e-8414-1e40820705e4@googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Wed, 31 Jul 2013 14:07:43 +0200 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1375272464 news.xs4all.nl 15891 [2001:888:2000:d::a6]:49378 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:51642 Op 29-07-13 01:41, rurpy@yahoo.com schreef: > 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 am just trying out some things for my self on python 3.2 so be sure to test this out but you could try the following. msg.set_charset('utf-8') msg['Content-Transfer-Encoding'] = '8bit' -- Antoon Pardon