# Querying non-printable characters from the database

**URL:** <https://forum.inductiveautomation.com/t/querying-non-printable-characters-from-the-database/60153>\
**Category:** Ignition\
**Tags:** ignition80, scripting\
**Created:** [May 29, 2022, 3:37pm UTC](https://forum.inductiveautomation.com/t/querying-non-printable-characters-from-the-database/60153 "2022-05-29T15:37:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![denji26](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/denji26/32/5805_2.png) [@denji26](https://forum.inductiveautomation.com/u/denji26)\
**Post date:** [May 29, 2022, 3:37pm UTC](https://forum.inductiveautomation.com/t/querying-non-printable-characters-from-the-database/60153/1 "2022-05-29T15:37:47Z")

</div>

I want to save DPL labels, similar to ZPL, in MSSQL database for future retrieval and printing. My problem is the DPL string contains non-printable characters that are being stripped out of my query results, for example the STX delimiter (start of line) \x02.

I assume the characters are being stored properly based on copying the string from management studio and pasting into notepad++ shows the missing characters

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/3/23c1271db6edf8bc340f157c158209bbf991857d.png)

However when I query the label string and print the results in ignition the STX delimiter is gone, however the end of line character is still present.

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/9/6960e55a3f99cb0bf0c36a524f4fbde74bbd948c.png)

Any help is greatly appreciated!

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [May 29, 2022, 4:27pm UTC](https://forum.inductiveautomation.com/t/querying-non-printable-characters-from-the-database/60153/2 "2022-05-29T16:27:29Z")

</div>

Is this any help?

```auto
string = "\02n\r\n\02M0592\r\n\02O0220\r\n"
charArray = [c for c in string]
print(charArray)

# Returns:
# ['\x02', 'n', '\r', '\n', '\x02', 'M', '0', '5', '9', '2', '\r', '\n', '\x02', 'O', '0', '2', '2', '0', '\r', '\n']

```

STX is `0x02`.

Try it in the script console.

---

<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:** [May 29, 2022, 5:11pm UTC](https://forum.inductiveautomation.com/t/querying-non-printable-characters-from-the-database/60153/3 "2022-05-29T17:11:44Z")

</div>

> [@denji26](#):
>
> and print the results

Many things won't print visibly even though they are there. If in doubt, especially when charsets are involved, use byte arrays and blob columns.

---

<div class="post-metadata">

**Author:** ![denji26](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/denji26/32/5805_2.png) [@denji26](https://forum.inductiveautomation.com/u/denji26)\
**Post date:** [May 29, 2022, 6:01pm UTC](https://forum.inductiveautomation.com/t/querying-non-printable-characters-from-the-database/60153/4 "2022-05-29T18:01:07Z")

</div>

Yeah I noticed that. When I read the file from disk then print the results the characters in question aren’t visible, but they are still there. When I query them from the database and print them they just aren’t there period, but they are in the database.

I think your suggestion of reading the label file as a byte array and storing it that way might be the way to go.
