Chinese in script

I have to send mail in script, and I use MIMEText to change unicode but it still gave me ‘?’.

this is my code

MIMEText(u"body text including an Euro char \u20ac\n 中文測試\n ", _charset=“utf-8”)

and mail show

body text including an Euro char Ž

How to fix it?
Thanks for help.

What version are you using?

Some time between Ignition 7.8.3 and Ignition 7.9.5 sending Chinese characters in emails broke, but as of 7.9.5 it’s working again without doing anything special. Here’s an example script that’s working as of 7.9.5:

recipients = ['']
smtp = ''
fromAddr = ''
subject = u'Subject: 学科', fromAddr=fromAddr, subject=subject, body=body, html=0, to=recipients)```

Hi Kathy,

My Ignition version is 7.9.7

I use your example script but not working.
It still get ‘???’ word.

Thanks for help!

Something is different with your setup than we use for testing. Could you contact support – that way we can figure out what it is and either help you get it set up correctly or fix a bug we don’t know about. Thanks!

Any solutions on this topic?

Try wrapping your string in unicode('我的文本字符串')

Doesn't work on me for email title.

What version are you using?


Hello guys, any solution one this topic?


IIRC, email standards don't have a way to use normal content encoding information with subject headers. There's an alternate form that is required.... RFC1342.

Try encoding it yourself using this approach.

1 Like

Thank you so much, would you please provide more details?

I haven't had to do this, so I have no details to add.