views:

50

answers:

2

I'm trying to send a django email with UTF-8 characters in the template, specifically:

S'il vous plaît

I get the error:

UnicodeDecodeError: 'utf8' codec can't decode byte 0x94 in position 147: unexpected code byte

When trying to encode the special "î" character (that is the character at that position.)

Here is my code for generating the email body:

template = loader.get_template('french_thank_you.html')
+1  A: 

0x94 is not part of î in UTF-8. The UTF-8 encoding for î is 0xc3 0xae.

Ignacio Vazquez-Abrams
+2  A: 

The editor you're using has saved the file using Mac Roman encoding. Open the template, re-save it as UTF-8, and it should work fine.

John Millikin
Thanks for the help! I was sure it was already utf-8, but was mistaken. Thanks again!
MikeN