Double-Value Unicode?

Scott Rossi scott at tactilemedia.com
Sat May 17 16:19:48 EDT 2014


On 5/17/14 12:03 PM, "Richmond" <richmondmathewson at gmail.com> wrote:


>>One item that would be helpful to know is at what value does a unicode
>>character start being represented as pairs?  Is 65536 the upper limit for
>>single value characters?
>>
><snip>
>
>Representing as pairs starts at Hex D800 = Decimal 55296


Using that number, the numToUnicodePair function could be updated to
accept any decimal value:

function numToUnicodePair pNum
   if pNum < 55296 then return pNum
   put trunc((pNum - 65536)/1024 + 55296) into num1
   put (pNum - 65536) mod 1024 + 56320 into num2
   return num1,num2
end numToUnicodePair



No change to the unicodePairToNum function:

function unicodePairToNum pNum1,pNum2
   return (pNum1 - 55296) * 1024 + (pNum2 - 56320) + 65536
end unicodePairToNum



Regards,

Scott Rossi
Creative Director
Tactile Media, UX/UI Design






More information about the Use-livecode mailing list