On 17/05/14 20:54, Scott Rossi wrote:
Maybe unnecessary for LC7, but for my work in LC6 (and anybody that's
interested), I put together the following functions for converting a
unicode surrogate pair to a single value and vice versa:
function unicodePairToNum pNum1,pNum2
return (pNum1 - 55296) * 1024 + (pNum2 - 56320) + 65536
end unicodePairToNum
function numToUnicodePair pNum
put trunc((pNum - 65536)/1024 + 55296) into num1
put (pNum - 65536) mod 1024 + 56320 into num2
return num1,num2
end numToUnicodePair
Thanks to Richmond for the link to unicode character calculations:
http://www.russellcottrell.com/greek/utilities/SurrogatePairCalculator.htm
Confession time . . .
"MOD 104" is not "MOD 1024"
entirely my fault.
Sorry people.
New version here, including something to catch Unicode addresses below
Hex 10000:
http://forums.runrev.com/viewtopic.php?f=6&t=20433&p=103854#p103854
Richmond.
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode