# Weird Perspective Label String Data

**URL:** <https://forum.inductiveautomation.com/t/weird-perspective-label-string-data/100803>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [January 13, 2025, 4:35pm UTC](https://forum.inductiveautomation.com/t/weird-perspective-label-string-data/100803 "2025-01-13T16:35:43Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Timothy\_Vertin](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@Timothy\_Vertin](https://forum.inductiveautomation.com/u/Timothy_Vertin)\
**Post date:** [January 13, 2025, 4:35pm UTC](https://forum.inductiveautomation.com/t/weird-perspective-label-string-data/100803/1 "2025-01-13T16:35:43Z")

</div>

Good Day,

I have a perspective project and am simply displaying a string in a label component. The string is coming from a Sparkplug B MQTT message via my MQTT broker, originating from a Canary Data Historian. The string is there but there are block characters between each character. Please help get rid of them!! Thank you in advance!

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/8/5874e662c7ff552dce2df9eeba2be576f082349f.png)

---

<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:** [January 13, 2025, 4:39pm UTC](https://forum.inductiveautomation.com/t/weird-perspective-label-string-data/100803/2 "2025-01-13T16:39:27Z")

</div>

It looks like a Unicode problem (\> 1 byte per character). Show us your text property binding (nicely formatted as code - see [Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831)).

---

<div class="post-metadata">

**Author:** ![Timothy\_Vertin](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@Timothy\_Vertin](https://forum.inductiveautomation.com/u/Timothy_Vertin)\
**Post date:** [January 13, 2025, 5:15pm UTC](https://forum.inductiveautomation.com/t/weird-perspective-label-string-data/100803/3 "2025-01-13T17:15:28Z")

</div>

Hey Transistor,

Thank you for the quick reply. There is no property binding just a direct tag binding therefore there is no code to attach.

Tim

---

<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:** [January 13, 2025, 5:41pm UTC](https://forum.inductiveautomation.com/t/weird-perspective-label-string-data/100803/4 "2025-01-13T17:41:35Z")

</div>

I'm struggling to recreate the problem.

Try adding an expression transform to your binding:  
`urlEncode({value})`  
This will show the HTTP encoding for any odd characters. (The space character, for example, is encoded as `%20`.)  
Paste the results in here.

A list of values here: [HTML URL Encoding Reference](https://www.w3schools.com/tags/ref_urlencode.ASP).

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [January 13, 2025, 5:48pm UTC](https://forum.inductiveautomation.com/t/weird-perspective-label-string-data/100803/5 "2025-01-13T17:48:48Z")

</div>

can you run this in your script console and post the results here?

```python
actualData = system.tag.readBlocking(['Path/to/suspect/tag'])[0].value

expectedString = "PREAHEAT"

print "Expected: ",expectedString
print "Actual: ",actualData
print "\r\n"

for i in range(len(actualData)):
    expChar = expectedString[i:i+1]
    actChar = actualData[i:i+1]
    print "Expected: " , expChar, " Ord: ", ord(expChar) if expChar != ""
    print "Actual: ", actChar, " Ord: ", ord(actChar) if actChar != ""

```

---

<div class="post-metadata">

**Author:** ![Timothy\_Vertin](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@Timothy\_Vertin](https://forum.inductiveautomation.com/u/Timothy_Vertin)\
**Post date:** [January 13, 2025, 5:52pm UTC](https://forum.inductiveautomation.com/t/weird-perspective-label-string-data/100803/6 "2025-01-13T17:52:20Z")

</div>

Expected Test: PREHEAT

Resulted of urlEncode:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/1/21ed69eb07495f131ca7bffc13b1d5cbbcf41496.png)

---

<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:** [January 13, 2025, 5:58pm UTC](https://forum.inductiveautomation.com/t/weird-perspective-label-string-data/100803/7 "2025-01-13T17:58:42Z")

</div>

It seems your string has null bytes preceding each character... you should really try to fix this at the source, but you might be able to use the `replace` expression function to replace the null's with "" (empty string).

---

<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:** [January 13, 2025, 6:57pm UTC](https://forum.inductiveautomation.com/t/weird-perspective-label-string-data/100803/8 "2025-01-13T18:57:35Z")

</div>

That's what I expected you would find and Kevin's solution was going to be my next suggestion.  
Try replacing the `urlEncode` transform with the expression,  
`replace({value}, char(0), "")`

(Since I haven't been able to create the problem this solution is untested.)
