On Mon, Jun 7, 2010 at 10:57 AM, José María <[email protected]> wrote:
> Hi.
>
> I've a strange problem while sending emails. I need to send emails
> with utf-8 content in the body and subject. While subjects show text
> fine, bodies always appear to have encoding problems.
>
> My test code is really simple:
>
> cadena =
>
> send_mail('Cosas que hacer mañana',
>                  'José María tiene mañana una reunión.',
>                  'josema...@localhost',
>                  ['josema...@localhost'],
>                  fail_silently=False)
>
> This is what appear in console with using EMAIL_BACKEND =
> 'django.core.mail.backends.console.EmailBackend' :
>
>
> Content-Type: text/plain; charset="utf-8"
> MIME-Version: 1.0
> Content-Transfer-Encoding: quoted-printable
> Subject: =?utf-8?q?Cosas_que_hacer_ma=C3=B1ana?=
> From: josema...@localhost
> To: josema...@localhost
> Date: Mon, 07 Jun 2010 10:52:54 -0000
> Message-ID: <[email protected]>
>
> Jos=C3=A9 Mar=C3=ADa tiene ma=C3=B1ana una reuni=C3=B3n.
>
>
> Once decoded this is the body (Thunderbird):
>
> José María tiene mañana una reunión.
>
> This must be a really stupid error, but I don't find it.
>
> Thanks!

I think the error is in your email client - that looks like perfectly
valid UTF-8 content in a quoted-printable transfer encoding, with the
correct headers.

>>> a='Jos\xc3\xa9'
>>> a.decode('utf-8')
u'Jos\xe9'
>>> print a.decode('utf-8')
José


Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to