Symbols in Labels

Anyone know how I go about getting the degrees symbol (º) into the text of a label? If I insert it into a string in my code it appears correctly in the IDE but doesn’t get properly encoded into the label when the program runs.

What am I missing?

I have this on a label open event:

me.text = "80°"

Run on macOS and it shows ok, remote debug to Windows 10 (virtualbox) and it shows ok. Maybe your using a “look alike” symbol, I don’t know, sorry.

Are you using mac or windows? Which Xojo version?

I’ve done some experimenting and there’s something else going on that I need to track down. If I put the string straight into the label it displays fine but when I assign it to property of a custom class and then assign that class property to the label the non-ascii symbols don’t display properly.

I will investigate further.

I think I’m zeroing in the problem. The text is formed by concatenation:

"º" + data(2)

and I’ve just noticed that, for some reason, the string in data(2) has its encoding set to Nil.

Alberto, thanks for your reply, just knowing it could be done made it much easier to track down.

The problem was that the strings in the data array were received from a remote device over a TCPSocket and I was calling the socket’s ReadAll function without specifying an encoding. I’ve set the ReadAll to use UTF8 and all is working as expected now.

I was just going to write asking if you do some encoding with the text. Great that you found the problem.