numToChar with socking great numbers

Richmond richmondmathewson at gmail.com
Wed Jan 15 04:38:33 EST 2014


On 15/01/14 10:03, Peter W A Wood wrote:
> Richmond
>
> Apparently the "Grinning Face" is included in the Deja Vu font which was/is included by default with Ubuntu (according to Wikipedia). Perhaps you can get LiveCode to use that ... at least to test the surrogate pairs.
>
> On a lesser note, LibreOffice includes Deja Vu and fortunately Deja Vu does not have the pile of poo you do not want.
>
> Regards
>
> Peter
>
>

I installed the Unicode consortium's "Last Resort" font: 
http://www.unicode.org/policies/lastresortfont_eula.html

and ran the script:

on mouseUp
    set the useUnicode to true
    set the unicodeText of fld "fff" to (numtoChar(55357) & 
numToChar(56832))
end mouseUp

and got a char saying "undefined  10000 1FFFD Plane 1"

U+1FFFD = 131069
U+10000 = 65536

so, that, at least, makes sense; and that would argue that a font with 
the smiley face should show the face.

AND; according to this: 
http://www.fontspace.com/unicode/char/1F601-grinning-face-with-smiling-eyes 
we should be OK:

so, adjusted the second surrogate pair to U+1F601 = 55357 & 56833, used 
DejaVu Sans, and got a smiley face !!!!!!

Obviously, DejaVu Sans does NOT have a glyph at 1F600.

then, did this:

on mouseUp
    set the useUnicode to true
    put the unicodeText of fld "fff" into FFF
    put charToNum(FFF) into fld "NUMM"
end mouseUp

and the number I got was 55357: the first number in the surrogate pair!

So it would seem that the surrogate pairs work in one direction [ 
numToChar ] but not the other way round [ charToNum ].

Richmond.







More information about the use-livecode mailing list