# Degree symbol in msg.payload

**URL:** <https://discourse.nodered.org/t/degree-symbol-in-msg-payload/55635>\
**Category:** General\
**Created:** [23 December 2021 23:15 UTC](https://discourse.nodered.org/t/degree-symbol-in-msg-payload/55635 "2021-12-23T23:15:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dokho](https://avatars.discourse-cdn.com/v4/letter/d/eb8c5e/32.png) [@dokho](https://discourse.nodered.org/u/dokho)\
**Post date:** [23 December 2021 23:15 UTC](https://discourse.nodered.org/t/degree-symbol-in-msg-payload/55635/1 "2021-12-23T23:15:37Z")

</div>

Hello.

I'm trying to add degree symbol (°C) in a msg.payload but something's wrong.

I use the function below:

```auto
msg.topic = "ECRAN-ENTREE/cmd";
msg.payload = Math.round(msg.payload.data_day.temperature_max[1])
msg.payload = msg.payload + "°C" ;
msg.payload = `NEXTION,home.t1.txt="${msg.payload}"`;
return msg;
```

The result is something like that: 15Â°C  
Why there is an Â before °C ?

Regards,

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [23 December 2021 23:23 UTC](https://discourse.nodered.org/t/degree-symbol-in-msg-payload/55635/2 "2021-12-23T23:23:50Z")

</div>

With this bit of code it works.

```auto
[{"id":"4199525f95a962f2","type":"inject","z":"65c9b63cb09879a0","name":"","props":[{"p":"payload.data_day.temperature_max","v":"[1,2,3,4]","vt":"json"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":2840,"y":1530,"wires":[["b0ef4d2772abb305"]]},{"id":"b0ef4d2772abb305","type":"function","z":"65c9b63cb09879a0","name":"","func":"msg.topic = \"ECRAN-ENTREE/cmd\";\nmsg.payload = Math.round(msg.payload.data_day.temperature_max[1])\nmsg.payload = msg.payload + \"°C\" ;\nmsg.payload = `NEXTION,home.t1.txt=\"${msg.payload}\"`;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":3000,"y":1530,"wires":[["a99e797e0140c213"]]},{"id":"a99e797e0140c213","type":"debug","z":"65c9b63cb09879a0","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":3170,"y":1530,"wires":[]}]

```

But I don't know what your real incoming message looks like.

 ![Screenshot from 2021-12-24 10-22-39](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/e/9e00975e570ddf6f66bbb6d633b385c0033f11f0.png)

How about you post what the incoming message is too?

---

<div class="post-metadata">

**Author:** ![xx\_Nexus\_xx](https://avatars.discourse-cdn.com/v4/letter/x/54ee81/32.png) [@xx\_Nexus\_xx](https://discourse.nodered.org/u/xx_Nexus_xx)\
**Post date:** [24 December 2021 01:07 UTC](https://discourse.nodered.org/t/degree-symbol-in-msg-payload/55635/3 "2021-12-24T01:07:41Z")

</div>

I would recommend a parseInt() to your msg.payload before you do + "°C" ... I use the + "°C" all the time and never seen that other symbol

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [24 December 2021 02:11 UTC](https://discourse.nodered.org/t/degree-symbol-in-msg-payload/55635/4 "2021-12-24T02:11:30Z")

</div>

Or `Number( )`

---

<div class="post-metadata">

**Author:** ![dokho](https://avatars.discourse-cdn.com/v4/letter/d/eb8c5e/32.png) [@dokho](https://discourse.nodered.org/u/dokho)\
**Post date:** [24 December 2021 11:36 UTC](https://discourse.nodered.org/t/degree-symbol-in-msg-payload/55635/5 "2021-12-24T11:36:09Z")

</div>

Thank you guys but the problem was not with nodered but with my display.

I will try to explain (i'm french and my english is ... poor): i'm using espeasy with nextion plugin to send data to a nextion screen. I send data to the plugin via mqtt.

For my degree symbol problem it was because the selected font was not good: with an utf-8 font it's OK.  
The msg.payload was good.

Thank you for your help.  
Have a merry christmas and an happy new year.

---

<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:** [7 January 2022 11:36 UTC](https://discourse.nodered.org/t/degree-symbol-in-msg-payload/55635/6 "2022-01-07T11:36:32Z")

</div>

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