Set Language for String Processing?
    Peter W A Wood 
    peterwawood at gmail.com
       
    Tue May  6 10:31:22 EDT 2014
    
    
  
Hi Fraser
On 6 May 2014, at 19:31, Fraser Gordon wrote:
> 
> On 6 May 2014, at 12:26, Peter W A Wood <peterwawood at gmail.com> wrote:
> 
>> 
>> PS I was truly impressed to find that comparing pre-composed and decomposed characters worked without the need for the strings to be normalised. For example, this test passes:
>> 
>> 	startTest "Unicode1"
>>  	put numToCodepoint(0xE7) into tPrecomposed
>> 	put  "c" & numToCodepoint(0x0327) into tDecomposed
>> 	assertEqual tPrecomposed, tDecomposed
>> 	endTest
> 
> If you do it again after doing a "set the formSensitive to true", you'll find they are no longer equal - formSensitive is the equivalent to caseSensitive but for normalisation.
It worked nicely in the message box:
	put numToCodepoint(0xE7) into tPrecomposed
	put  "c" & numToCodepoint(0x0327) into tDecomposed
	set the formSensitive to true
	put tPrecomposed <> tDecomposed into tResult
	set the formSensitive to false	
	put return after tResult
	put tPrecomposed = tDecomposed after tResult
	put tResult
Produced:
	true
	true
But when I tried it in my test script, setting the formSensitive to true didn't seem to have the same effect:
on mouseUp
	startTest "Unicode1"
	put numToCodepoint(0xE7) into tPrecomposed
	put "c" & numToCodepoint(0x0327) into tDecomposed
	assertEqual tPrecomposed, tDecomposed
	endTest
	
	startTest "Unicode2"
	put numToCodepoint(0xE7) into tPrecomposed
	put "c" & numToCodepoint(0x0327) into tDecomposed
	set the formSensitive to true
	assertNotEqual tPrecomposed, tDecomposed
	set the formSensitive to false
	endTest
end mouseUp
The result was:
	Test Unicode2
	Assert #1
	Expected ç
	Actual ç 
	Unicode2 Failed
I suspect that I am probably doing something wrong such as trying to set formSensitive in a handler.
Regards
Peter
    
    
More information about the use-livecode
mailing list