ASCII, Unicode and Livecode
Richmond Mathewson
richmondmathewson at gmail.com
Tue Aug 16 13:48:21 EDT 2011
So, there I am reading a BBC computer manual (as one does) where I am
informed that the ASCII set consists of 128 chars . . .
. . . that's funny, because I had 256 (i.e. 2 x 128) rumbling around in
my mind.
As I have to develop a script that determines whether a char is a
single-byte char or the first half of a double-byte char . . . ouch . .
. this is probably fairly важно, to use a rather useful Bulgarian word . . .
Messing around in Livecode, I set up a stack with 2 fields; one
containing a string of ASCII text:
"LAT" Еat my cheese
and the other containing a Unicode string:
"UNIK" 'a Sanskrit word' I won't try to represent here [anyway, a spot
of juicy double-byted goodness]
then I set up a third field called "C1"
2 buttons; one to get the charToNum for the first char in fld "LAT", and
one to do the
same for fld "UNIK"
they both contain this sort of script:
on mouseUp
put charToNum(char 1 of fld "LAT") into fld "C1"
end mouseUp
and that's all very jolly, except that
on mouseUp
put charToNum(char 1 of fld "UNIK") into fld "C1"
end mouseUp
returns "9" which is within the ASCII range, so there is no way I can
use that sort of script to determine what I want to.
More information about the use-livecode
mailing list