Symbols in Labels

  1. 9 weeks ago

    Peter L

    Sep 13 Pre-Release Testers, Xojo Pro Australia

    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?

    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.

  2. Alberto D

    Sep 13 Pre-Release Testers, Xojo Pro
    Edited 9 weeks ago

    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?

  3. Peter L

    Sep 13 Pre-Release Testers, Xojo Pro Australia

    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.

  4. Peter L

    Sep 13 Pre-Release Testers, Xojo Pro Australia

    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.

  5. Peter L

    Sep 13 Pre-Release Testers, Xojo Pro Answer Australia

    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.

  6. Alberto D

    Sep 13 Pre-Release Testers, Xojo Pro

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

or Sign Up to reply!