Hex Symbols in strings

I have a macro with the line:
msgbox "5" & hex("00b0") & "C"

It produces a message:

50C

Is LO basic unable to preserve a degree symbol? Does anyone know a workaround?

msgbox "5°C"
msgbox format(5, "0.0°C")
msgbox "5" & chr(176) &"C"
msgbox "5" & chr( &hb0) &"C"

Thanks for the workaround! Anyone know why my version didn’t work?

hex converts integers into their textual hex-äquivalent nothing else, … makes no sense throwing a hex-symbol on it!

Not sure I understand your meaning…

your personal expectations about hex(…) are nonsense!!

https://help.libreoffice.org/6.4/en-US/text/sbasic/shared/03080801.html

Ah, now I see what you mean. I was trying to get hex() to do something other than what it does. I didn’t look closely enough at that help page, at first glance, it looked like what I needed. Really, it converts a base-10 number to a base-16 number, which has to be a string because it’s base 16.