Looking over this, this looks correct. For correct input and output it is equivalent to the logic based formula that I gave.
On May 17, 2014, at 11:54 AM, Scott Rossi <sc...@tactilemedia.com> 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 > > > > 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? > > > Thanks & Regards, > > Scott Rossi > Creative Director > Tactile Media, UX/UI Design > > > > > On 5/16/14 4:58 PM, "Scott Rossi" <sc...@tactilemedia.com> wrote: > >> Hi All: >> >> I thought I had figured out the display of Unicode glyphs in LC 6.6, and >> then ran up against a threshold where the value of a character is >> displayed as two values. I'm guessing this is related to a "double-byte" >> something or other. How does one retrieve the value of a character as a >> single value? >> >> For example, I can set the htmlText of a field to 📞 and get the >> correct unicode character to display. But when retrieving the value for >> the character, I get: �� >> >> Can I encode/decode/jumpcode/flipcode something here to get a single >> value >> representation of the character? >> >> (Also, I'm unable set the value of the by setting the unicodeText to >> numToChar(128222) -- only using the htmlText property seems to work). >> >> >> Thanks for helping out this uniclueless dude. >> >> Regards, >> >> Scott Rossi >> Creative Director >> Tactile Media, UX/UI Design >> > > > > _______________________________________________ > 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 _______________________________________________ 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