Unicode menu and script characters changing unexpectedly

Graham Samuel livfoss at mac.com
Thu Nov 20 13:25:53 EST 2014


Thanks for that thought Peter. RunRev are now on the case, but I still have not absolute confirmation that it's a bug. I did check that my stack is using the 7.0 file format (if it wasn't, it would be easy to see what went wrong). I'll report here when I get more info.

Graham

> On 20 Nov 2014, at 14:06, Peter W A Wood <peterwawood at gmail.com> wrote:
> 
> Graham
> 
> It may be that that whilst string data processed by our LiveCode scripts and handlers is Unicode that is not the case with UI objects. I think that there is a chance that LiveCode is still using native encoding (Windows Code Page on Windows, ISO-8859-1 on Linux and the truly venerable MacRoman on OS X). 
> 
> I’m not sure how to check but would imagine many people on the list do.
> 
> Regards
> 
> Peter
> 
>> On 20 Nov 2014, at 19:23, Graham Samuel <livfoss at mac.com> wrote:
>> 
>> 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
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list