Unicode menu and script characters changing unexpectedly

Graham Samuel livfoss at mac.com
Thu Nov 20 06:23:21 EST 2014


I’ve got a strange problem that (so far) I haven’t been able to reduce to a simple recipe.

I’m using a few Unicode characters in some menus in a cross-platform app (I mean special characters that don't appear on a Windows keyboard - I do realise that everything in LC is Unicode now). In this instance I’m using LC 7.0.1 rc-2 on a Mac with Yosemite simulating a PC using Windows 7 with Parallels.

I have a menu script in an Edit menu that looks for menu items in the usual way, using a switch statement. As an example, one of the items is the square root sign, whose Unicode encoding is 0x221A. The item reads

 Insert √

[I hope the last character - the square root sign - comes across in this email]. Initially, I got the square root character via the IDE, by executing

  put numToCodePoint(0x221A)

in the Message Box and copying it, so I know I've got the real character and not one that looks that the same but is part of the special non-standard Mac set, or a glyph derived from html. 

I pasted this character into the menu item and in the corresponding script, and I could see both strings quite clearly. However, when I save my stack, quit from LC, go back in and look at it again, the square root character has disappeared, BOTH in the script and in the menu item, to be replaced by '?' or sometimes a character whose Unicode encoding turns out to be 24. This is very odd, and pretty repeatable: however when I try to reproduce the problem in a very simple stack with one card and one menu bar, things look fine and the issue doesn't show up.

I just found out that if I recreate this menu item and corresponding script on a Mac with LC 7.0.1 rc-2, it looks OK there, but if I open the SAME FILE in Windows 7, the characters have already been changed. So it looks as if LC 7 is not allowing Unicode to 'just work' across platforms, but it is not at all a straightforward issue. For example, I have some ordinary text in fields in my app containing the square root character, and they don't go through this transformation - curiouser and curiouser...

Obviously I am struggling to get something to show the mother ship, and to work out if there is anything my code could have done to cause this (seems unlikely, since I don't execute any of my own scripts before seeing the anomaly) - but meanwhile, can anyone shed any light on this?

TIA

Graham



More information about the use-livecode mailing list