# Chinese in script

**URL:** <https://forum.inductiveautomation.com/t/chinese-in-script/18578>\
**Category:** Ignition\
**Created:** [June 22, 2018, 2:00am UTC](https://forum.inductiveautomation.com/t/chinese-in-script/18578 "2018-06-22T02:00:23Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![willyaako](https://avatars.discourse-cdn.com/v4/letter/w/ba9def/32.png) [@willyaako](https://forum.inductiveautomation.com/u/willyaako)\
**Post date:** [June 22, 2018, 2:00am UTC](https://forum.inductiveautomation.com/t/chinese-in-script/18578/1 "2018-06-22T02:00:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![KathyApplebaum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kathyapplebaum/32/7261_2.png) [@KathyApplebaum](https://forum.inductiveautomation.com/u/KathyApplebaum)\
**Post date:** [June 22, 2018, 2:21pm UTC](https://forum.inductiveautomation.com/t/chinese-in-script/18578/2 "2018-06-22T14:21:23Z")

</div>

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:

````auto
recipients = ['foo@bar.com']
smtp = 'mail.foobar.com'
fromAddr = 'tester@bar.com'
subject = u'Subject: 学科'
system.net.sendEmail(smtp=smtp, fromAddr=fromAddr, subject=subject, body=body, html=0, to=recipients)```
````

---

<div class="post-metadata">

**Author:** ![willyaako](https://avatars.discourse-cdn.com/v4/letter/w/ba9def/32.png) [@willyaako](https://forum.inductiveautomation.com/u/willyaako)\
**Post date:** [June 25, 2018, 1:08am UTC](https://forum.inductiveautomation.com/t/chinese-in-script/18578/3 "2018-06-25T01:08:38Z")

</div>

Hi Kathy,

My Ignition version is 7.9.7

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

Thanks for help!

---

<div class="post-metadata">

**Author:** ![KathyApplebaum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kathyapplebaum/32/7261_2.png) [@KathyApplebaum](https://forum.inductiveautomation.com/u/KathyApplebaum)\
**Post date:** [June 25, 2018, 1:54pm UTC](https://forum.inductiveautomation.com/t/chinese-in-script/18578/4 "2018-06-25T13:54:35Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![weixionglichina](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/weixionglichina/32/10650_2.png) [@weixionglichina](https://forum.inductiveautomation.com/u/weixionglichina)\
**Post date:** [October 19, 2023, 12:17pm UTC](https://forum.inductiveautomation.com/t/chinese-in-script/18578/7 "2023-10-19T12:17:40Z")

</div>

Any solutions on this topic?

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [October 20, 2023, 11:20am UTC](https://forum.inductiveautomation.com/t/chinese-in-script/18578/8 "2023-10-20T11:20:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![weixionglichina](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/weixionglichina/32/10650_2.png) [@weixionglichina](https://forum.inductiveautomation.com/u/weixionglichina)\
**Post date:** [October 20, 2023, 2:30pm UTC](https://forum.inductiveautomation.com/t/chinese-in-script/18578/9 "2023-10-20T14:30:14Z")

</div>

Doesn't work on me for email title.

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [October 20, 2023, 2:31pm UTC](https://forum.inductiveautomation.com/t/chinese-in-script/18578/10 "2023-10-20T14:31:30Z")

</div>

What version are you using?

---

<div class="post-metadata">

**Author:** ![weixionglichina](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/weixionglichina/32/10650_2.png) [@weixionglichina](https://forum.inductiveautomation.com/u/weixionglichina)\
**Post date:** [October 20, 2023, 2:31pm UTC](https://forum.inductiveautomation.com/t/chinese-in-script/18578/11 "2023-10-20T14:31:50Z")

</div>

8.1.24

---

<div class="post-metadata">

**Author:** ![weixionglichina](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/weixionglichina/32/10650_2.png) [@weixionglichina](https://forum.inductiveautomation.com/u/weixionglichina)\
**Post date:** [October 23, 2023, 11:44am UTC](https://forum.inductiveautomation.com/t/chinese-in-script/18578/12 "2023-10-23T11:44:00Z")

</div>

Hello guys, any solution one this topic?

Thanks,

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 23, 2023, 12:04pm UTC](https://forum.inductiveautomation.com/t/chinese-in-script/18578/13 "2023-10-23T12:04:26Z")

</div>

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.

[https://www.telemessage.com/developer/faq/how-do-i-encode-non-ascii-characters-in-an-email-subject-line/](https://www.telemessage.com/developer/faq/how-do-i-encode-non-ascii-characters-in-an-email-subject-line/)

Try encoding it yourself using this approach.

---

<div class="post-metadata">

**Author:** ![weixionglichina](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/weixionglichina/32/10650_2.png) [@weixionglichina](https://forum.inductiveautomation.com/u/weixionglichina)\
**Post date:** [October 23, 2023, 3:22pm UTC](https://forum.inductiveautomation.com/t/chinese-in-script/18578/14 "2023-10-23T15:22:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 23, 2023, 3:28pm UTC](https://forum.inductiveautomation.com/t/chinese-in-script/18578/15 "2023-10-23T15:28:40Z")

</div>

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