# Special character handling

**URL:** <https://discourse.nodered.org/t/special-character-handling/92366>\
**Category:** General\
**Tags:** function-node\
**Created:** [14 October 2024 06:26 UTC](https://discourse.nodered.org/t/special-character-handling/92366 "2024-10-14T06:26:19Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mr-jaffery](https://avatars.discourse-cdn.com/v4/letter/m/6f9a4e/32.png) [@mr-jaffery](https://discourse.nodered.org/u/mr-jaffery)\
**Post date:** [14 October 2024 06:26 UTC](https://discourse.nodered.org/t/special-character-handling/92366/1 "2024-10-14T06:26:19Z")

</div>

Hi all,

I have a nodered flow in place which has a fucntion node which recieves a json input. Inside the json input there's a key named "Cold Plate Temperature (°C)". And in the function node I'm defining a variable as

```auto
var coldPlateTemperatureKeyName = 'Cold Plate Temperature (°C)'

```

 ![image-20241011-144528](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/f/cf1d8fd7b0fb3c025fcfb5163e70a8280f1d10de.png)

which is then used to derefence the json object like so

```auto
msg.payload.NonFastDaq.Demo_PMNTPLUS.values[coldPlateTemperatureKeyName]

```

Now, this works perfectly for the most of the time, but sometimes nodered ramdomly changes the 'Cold Plate Temperature (°C)' to 'Cold Plate Temperature (�C)' either in code of function node or in the input json object (screenshots attached) which then results in an error where the key is not found in the object and creates issues.

 ![image-20241011-143854](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/3/03bdabbce19890e9166d35853c7ab86ccfe33c67.png)  
 ![image-20241011-144610](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/1/f1b6af984dcf4f81cd686d4d328009c7ca132814.png)

Any leads on how this can be avoided?

Thanks

---

<div class="post-metadata">

**Author:** ![GogoVega](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gogovega/32/71313_2.png) [@GogoVega](https://discourse.nodered.org/u/GogoVega)\
**Post date:** [14 October 2024 06:39 UTC](https://discourse.nodered.org/t/special-character-handling/92366/2 "2024-10-14T06:39:20Z")

</div>

What version of Node-RED do you have?

---

<div class="post-metadata">

**Author:** ![mr-jaffery](https://avatars.discourse-cdn.com/v4/letter/m/6f9a4e/32.png) [@mr-jaffery](https://discourse.nodered.org/u/mr-jaffery)\
**Post date:** [14 October 2024 06:52 UTC](https://discourse.nodered.org/t/special-character-handling/92366/3 "2024-10-14T06:52:13Z")

</div>

Node-Red version is 4.0.2-22

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [14 October 2024 07:05 UTC](https://discourse.nodered.org/t/special-character-handling/92366/4 "2024-10-14T07:05:19Z")

</div>

There was a similar report about scented characters here: [node-red - node name with accented characters not displayed correctly - lead to deployment issue · Issue #4871 · node-red/node-red · GitHub](https://github.com/node-red/node-red/issues/4871) - might be related.

Although the cause is unknown, it does seem to have disappeared in later versions of node-red.

---

<div class="post-metadata">

**Author:** ![mr-jaffery](https://avatars.discourse-cdn.com/v4/letter/m/6f9a4e/32.png) [@mr-jaffery](https://discourse.nodered.org/u/mr-jaffery)\
**Post date:** [14 October 2024 09:36 UTC](https://discourse.nodered.org/t/special-character-handling/92366/5 "2024-10-14T09:36:33Z")

</div>

Ok so i should just update to 4.0.3?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [14 October 2024 09:37 UTC](https://discourse.nodered.org/t/special-character-handling/92366/6 "2024-10-14T09:37:31Z")

</div>

You can, but there are other (different) issues in that one - I'd recommend latest (4.0.5)

---

<div class="post-metadata">

**Author:** ![gregorius](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gregorius/32/73816_2.png) [@gregorius](https://discourse.nodered.org/u/gregorius)\
**Post date:** [14 October 2024 16:08 UTC](https://discourse.nodered.org/t/special-character-handling/92366/7 "2024-10-14T16:08:59Z")

</div>

I had the same problem with the degree symbol ([U+00B0](https://wumbo.net/symbols/degrees/)) and I ended up replacing the symbol with the stanza `decodeURIComponent('%C2%B0')`. What was happening was that the symbol was being replaced when I saved my flows.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [12 January 2025 16:09 UTC](https://discourse.nodered.org/t/special-character-handling/92366/8 "2025-01-12T16:09:33Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
