Double-Value Unicode?

Dar Scott dsc at swcp.com
Fri May 16 22:19:07 EDT 2014


The good news is that LiveCode 7 will not have this problem, but it still might sneak in if one is not careful.

With LiveCode 7, the codePoint chunk will apply even to U+1F4DE (a new character, I guess, for a phone?), that is, 128222.  However, if you look at the implementation level, the codeUnit, you will see the two numbers you describe.  These are surrogates, away for 16-bit representation to include characters above U+FFFF, or outside the BMP.  

So to represent those high codes, two 16-bit codes are used.  These are assigned but never occur in LiveCode 7 code points, only in the implementation code units.  So, if you’re working with characters or code points, you are good.  With 7.

For now…

There is a way to calculate the full code from the surrogates.  

Take the least significant 10 bits of the first number, add 0x40 and then shift left 10 bits.  Add that to the least significant 10 bits of the second number.  Stand on one foot and...

It is probably someplace online in a clearer form.

Dar


On May 16, 2014, at 5:58 PM, Scott Rossi <scott at 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 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