Opened 14 years ago

Last modified 11 years ago

#12422 closed Bug

Django overrides the default email charset behaviour for utf-8 — at Version 6

Reported by: Simon Blanchard Owned by: nobody
Component: Core (Mail) Version: dev
Severity: Normal Keywords: charset utf-8
Cc: bnomis@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description (last modified by Aymeric Augustin)

# Don't BASE64-encode UTF-8 messages so that we avoid unwanted attention from
# some spam filters.
Charset.add_charset('utf-8', Charset.SHORTEST, Charset.QP, 'utf-8')

The above bit of code in django.core.mail overrides the standard Python behaviour for utf-8 in the Python email module. It would be better to set the charset by calling set_charset() on the Message before sending if needed rather than a global override. This behaviour and assumption is not documented anywhere in Django as far as I can tell. I think this is a case of the framework being a bit too clever. Not everyone using Django is using the django email sending methods nor wants Django to (silently) change the system defaults.

For example, I use the standard Python email sending methods and was expecting the Python lib to behave as advertised but the encoding of my utf-8 messages kept coming out quoted-printable because of the override above.

Change History (6)

comment:1 by Russell Keith-Magee, 14 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Simon Blanchard, 14 years ago

Cc: bnomis@… added

comment:3 by Matt McClanahan, 13 years ago

Severity: Normal
Type: Bug

comment:4 by Aymeric Augustin, 12 years ago

UI/UX: unset

Change UI/UX from NULL to False.

comment:5 by Aymeric Augustin, 12 years ago

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:6 by Aymeric Augustin, 12 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top