# System.tag.read unicode characters

**URL:** <https://forum.inductiveautomation.com/t/system-tag-read-unicode-characters/43392>\
**Category:** Ignition\
**Created:** [February 14, 2021, 7:58pm UTC](https://forum.inductiveautomation.com/t/system-tag-read-unicode-characters/43392 "2021-02-14T19:58:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![weertske](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/weertske/32/3353_2.png) [@weertske](https://forum.inductiveautomation.com/u/weertske)\
**Post date:** [February 14, 2021, 7:58pm UTC](https://forum.inductiveautomation.com/t/system-tag-read-unicode-characters/43392/1 "2021-02-14T19:58:30Z")

</div>

This is a project running with Swedish fonts on Ignition 7.9.13

We have a tag called RecipeName and for example it might contain the string: “61176 Köttfärssås till Paj”. This string shows up properly throughout Ignition and within MySQL. However, when I read that tag using system.tag.read and then write that tag to a Siemens S7 PLC using system.opc.writeValue, the string gets corrupted to “61176 K�ttf�rss�s till Paj”

I am not sure if the corruption is occurring at the read or write stage. If I create a button to run a read script and then print the result on the console it returns the correct value. However, if I use system.util.getLogger to log the value to the console (in Designer) it returns the corrupted string.

Any insight would be appreciated.

---

<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:** [February 14, 2021, 8:31pm UTC](https://forum.inductiveautomation.com/t/system-tag-read-unicode-characters/43392/2 "2021-02-14T20:31:23Z")

</div>

Ignition strings use 16-bit unicode characters. Siemens strings are 8-bits per character. Without careful application of an 8-bit codec in both directions (UTF-8, perhaps), both reading and writing will corrupt the string.

---

<div class="post-metadata">

**Author:** ![weertske](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/weertske/32/3353_2.png) [@weertske](https://forum.inductiveautomation.com/u/weertske)\
**Post date:** [February 14, 2021, 9:01pm UTC](https://forum.inductiveautomation.com/t/system-tag-read-unicode-characters/43392/3 "2021-02-14T21:01:08Z")

</div>

Thank you Phil. Even before I get to writing it to the Siemen’s PLC I seem to be running into an issue with just reading the tag and logging it. Of course this could be that the logger is not handling it well.

If I read the Ignition tag (as recipeName) and then encode it (recipeName.encode(‘utf8’)) before I do the opc write, do you think that will work?

---

<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:** [February 14, 2021, 9:32pm UTC](https://forum.inductiveautomation.com/t/system-tag-read-unicode-characters/43392/4 "2021-02-14T21:32:19Z")

</div>

There’s a chance this is an issue with our Siemens driver as well. I doubt it’s explicitly setting the Charset to UTF-8 when turning the String to bytes to write. This oversight is common in older code that deals with Strings.

---

<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:** [February 15, 2021, 12:32am UTC](https://forum.inductiveautomation.com/t/system-tag-read-unicode-characters/43392/5 "2021-02-15T00:32:45Z")

</div>

Do you have any HMI products that already display extended characters from these S7 strings? If so, play with the actual bytes from such content to identify the codec. Older systems would typically pick one of the “Latin-NN” charsets to keep the string 1 byte per character. When you figure it out, try that codec on the Ignition side.
