Sending email in utf-8?
Fredrik Lundh
fredrik at pythonware.com
Tue Nov 8 07:40:25 EST 2005
"morphex" <morphex at gmail.com> wrote:
> """
> Date: Mon, 7 Nov 2005 11:38:29 -0700 (MST)
> Message-Id: <200511071838.jA7IcTKR095057 at thinkering.com>
> To: morten at nidelven-it.no, morten at nidelven-it.no
> From: morten at nidelven-it.no
> Subject: Order confirmation
> Content-Type: text/plain; charset="utf-8"
> X-Bogosity: No, tests=bogofilter, spamicity=0.000000, version=0.92.8
>
> Thank you for your order, it is copied here for your convenience, and
> we will process it shortly.
>
> Name: ø
> Phone: ø
> Email: morten at nidelven-it.no
> Comments: asdf
> """
that's 0xC3 0xB8 (at least according to my mail reader), which, translated
back from UTF-8, looks like a typically norsk character to me...
>>> name = "\xc3\xb8".decode("utf-8")
>>> print name
ø
>>> import unicodedata
>>> unicodedata.name(name)
'LATIN SMALL LETTER O WITH STROKE'
try adding a "Mime-Version: 1.0" header to your mail.
a "Content-Transfer-Encoding: 8bit" might not hurt either (or run the body through
quopri.encodestring() after you've encoded it, and use "Content-Transfer-Encoding:
quoted-printable").
(also check the email package: http://docs.python.org/lib/module-email.html )
</F>
More information about the Python-list
mailing list