Unicode in HMTL emails

Thanks for the great intro. I was still struggling to get some HTML formatted emails I was sending with python to show unicode characters correctly. In the end, I found that the encode method has a really useful parameter: 'xmlcharrefreplace' that will turn any characters that can't be represented in ascii into #nnnn; type html/xml code

example:

str.encode('us-ascii','xmlcharrefreplace')

Reply

The content of this field is kept private and will not be shown publicly.