± symbol in ui_text node label

Hi folks,

simple question this time, is it possible to have a ± symbol in a ui_text label ? if so how ?

I'm trying to do this, but a bit neater . . .
image

so it would be . . .

Volts 3.2 - 3.4 ± 21 - 23

as the label.

Yes, using key codes to display special characters.

https://tools.oratory.com/altcodes.html

The one you are looking for is Alt 241

image

Depends how you fill the ui_txt label.
In a function node you can do simpel this

msg.payload = "Volts 3.2 - 3.4 ± 21-23"
return msg;

Example:

[{"id":"8769ab57.dea6","type":"inject","z":"4c67c901.6c7988","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":170,"y":60,"wires":[["a903082.f28d1f8"]]},{"id":"a903082.f28d1f8","type":"function","z":"4c67c901.6c7988","name":"","func":"msg.payload = \"Volts 3.2 - 3.4 ± 21-23\"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":350,"y":60,"wires":[["af83070c.73a26"]]},{"id":"af83070c.73a26","type":"ui_text","z":"4c67c901.6c7988","group":"b1015362.70285","order":7,"width":0,"height":0,"name":"","label":"text","format":"{{msg.payload}}","layout":"row-spread","x":560,"y":60,"wires":[]},{"id":"b1015362.70285","type":"ui_group","name":"TEstGroep","tab":"cb1110e8.87fd1","order":1,"disp":true,"width":"6","collapse":false},{"id":"cb1110e8.87fd1","type":"ui_tab","name":"Tab 1","icon":"dashboard","order":1}]

Capture

edit: You can also use the numeric code, for this or other Math or special symbol.

msg.payload = "Volts 3.2 - 3.4 "+ '±' + " 21-23"
return msg;
1 Like

Sure you can just paste it in the label field, or save it as variable and use mustache syntax.
e.g.

[{"id":"e9366ca3.d23888","type":"inject","z":"c74669a0.6a34f8","name":"","props":[{"p":"payload"},{"p":"label","v":"Volts 3.2 - 3.4 ± 21 - 23","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"200","payloadType":"str","x":260,"y":4440,"wires":[["93620258.0d0c","1f14adea.165232"]]},{"id":"1f14adea.165232","type":"ui_text","z":"c74669a0.6a34f8","group":"8b5cde76.edd58","order":14,"width":0,"height":0,"name":"","label":"{{msg.label}}","format":"{{msg.payload}}","layout":"col-center","x":620,"y":4480,"wires":[]},{"id":"8b5cde76.edd58","type":"ui_group","name":"","tab":"8f03e639.85956","order":1,"disp":true,"width":"12","collapse":false},{"id":"8f03e639.85956","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]
1 Like

Alt + 241 changes tab in Chrome . . . isn't Alt + number specifically for use with a numeric keypad on a keyboard ? I'm on a laptop and remoting into my Raspberry PI running Node Red, probably should have mentioned that in my post.

I simply wanted to enter the label field manually in the node.

This doesn't work for me, I imported your flow and see this in the function node . . .

msg.payload = "Volts 3.2 - 3.4 � 21-23"

I'm on a Raspberry PI running Node Red, probably should have mentioned that in my post.

Sorry, this doesn't work either . . .
image

Doesn't do that for me

Possibly.. I always use the numerical keypad, so don't know otherwise, but may test it one day.
EDIT - Using top row numbers does nothing. Number pad always works for that and other Symbols I tend to use, like degrees ° (ALT 248 or ALT 0176)

Same here.

And it works just fine so far...

image

image

image

1 Like

Sure it works, if it doesn't for you, it is probably a browser/web font issue.
works on firefox and chrome for me

1 Like

How weird . . . on the pi I can get this in the text editor, Volts 3.2-3.4 ± 21 - 23 but if I copy and paste that into the node label I get this:

Maybe its a Node Red version thing, I'm on 1.3.5 on a reasonably recent OS build on the pi

\u00b1 is the UNICODE for the same ± symbol

image

Gets confusing, what with all these differing ways of displaying funny characters and shapes :stuck_out_tongue: Some work better with the keyboard and others better programmatically.

Yup, I realised that but still don't understand why I can enter the correct character.

Got it working now though using the following entered directly into the node label field: Volts 3.2-3.4 &#177 21 - 23

Thanks to all for the help :+1:

1 Like

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