# How to handle unicode characters in python scripts

**URL:** <https://forum.inductiveautomation.com/t/how-to-handle-unicode-characters-in-python-scripts/32596>\
**Category:** Ignition\
**Tags:** ignition80, scripting, perspective\
**Created:** [February 25, 2020, 5:09pm UTC](https://forum.inductiveautomation.com/t/how-to-handle-unicode-characters-in-python-scripts/32596 "2020-02-25T17:09:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![janne.p](https://avatars.discourse-cdn.com/v4/letter/j/7ea924/32.png) [@janne.p](https://forum.inductiveautomation.com/u/janne.p)\
**Post date:** [February 25, 2020, 5:09pm UTC](https://forum.inductiveautomation.com/t/how-to-handle-unicode-characters-in-python-scripts/32596/1 "2020-02-25T17:09:22Z")

</div>

I have been trying to make pyhon script in ignition which generates strings with scandic leters (ä ö), but the problem is that printing and handling that text is almost impossible to get rigth encoding and format.

Is there a certain way to handle unicode characters in ignition?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [February 25, 2020, 5:23pm UTC](https://forum.inductiveautomation.com/t/how-to-handle-unicode-characters-in-python-scripts/32596/2 "2020-02-25T17:23:37Z")

</div>

Are you prefixing your string literals with `u`, as in; `u"my stringä ö"`?

Your post is tagged 8.0 & perspective - are you trying to display these characters in Perspective components? Or can you go into more detail about precisely where you’re trying to render these characters and what’s not working?

---

<div class="post-metadata">

**Author:** ![Sourabh\_Ambildhuke](https://avatars.discourse-cdn.com/v4/letter/s/f1d935/32.png) [@Sourabh\_Ambildhuke](https://forum.inductiveautomation.com/u/Sourabh_Ambildhuke)\
**Post date:** [November 23, 2022, 11:23am UTC](https://forum.inductiveautomation.com/t/how-to-handle-unicode-characters-in-python-scripts/32596/3 "2022-11-23T11:23:33Z")

</div>

Hi all,

can i store the ö german character in SQL Database using named query

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [November 23, 2022, 11:58am UTC](https://forum.inductiveautomation.com/t/how-to-handle-unicode-characters-in-python-scripts/32596/4 "2022-11-23T11:58:16Z")

</div>

Did you try ?

edit: And it's not a specifically German character, we use it in France as well.

---

<div class="post-metadata">

**Author:** ![Sourabh\_Ambildhuke](https://avatars.discourse-cdn.com/v4/letter/s/f1d935/32.png) [@Sourabh\_Ambildhuke](https://forum.inductiveautomation.com/u/Sourabh_Ambildhuke)\
**Post date:** [November 23, 2022, 12:00pm UTC](https://forum.inductiveautomation.com/t/how-to-handle-unicode-characters-in-python-scripts/32596/5 "2022-11-23T12:00:52Z")

</div>

I tried but it is giving me character as

original char = Roboter 1\_Wendelföxyz 1 Prüfspannungsschluß bei der Bolzen Entnahme

printed char = Roboter 1\_Wendelf\xf6xyz 1 Pr\xfcfspannungsschlu\xdf bei der Bolzen Entnahme

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [November 23, 2022, 12:19pm UTC](https://forum.inductiveautomation.com/t/how-to-handle-unicode-characters-in-python-scripts/32596/6 "2022-11-23T12:19:14Z")

</div>

Share the code you used? What kind of column is the table in your database?

---

<div class="post-metadata">

**Author:** ![Sourabh\_Ambildhuke](https://avatars.discourse-cdn.com/v4/letter/s/f1d935/32.png) [@Sourabh\_Ambildhuke](https://forum.inductiveautomation.com/u/Sourabh_Ambildhuke)\
**Post date:** [November 24, 2022, 6:30am UTC](https://forum.inductiveautomation.com/t/how-to-handle-unicode-characters-in-python-scripts/32596/7 "2022-11-24T06:30:06Z")

</div>

The named query is  
INSERT INTO [CG\_Process\_data\_pool].[dbo].[FA\_WendelfordererLog] (mainWeldMc,boltNr,cabType,machineName,AlarmText)  
VALUES (:mainWeldMc,:boltNr,:cabType,:machineName,:AlarmText)

Here AlarmText param value we are passing from script and text is  
Roboter 1\_Wendelföxyz 1 Prüfspannungsschluß bei der Bolzen Entnahme

so, the same text we have to pass in db.

The Column datatype is nvarchar(255)
