Unicode, the clipboard and LC fields
Richmond
richmondmathewson at gmail.com
Wed Jan 22 09:20:49 EST 2014
On 22/01/14 15:47, Graham Samuel wrote:
> I am not sure if I could glean this from the current LC docs but it doesn't look easy. Maybe someone here could give me a clue:
>
> I have a desktop app which contains a field into which the user can type a character string which is then manipulated by the app. The user can just use the keyboard, but they can also paste something into the field. This may be
>
> a) straight ascii
>
> b) the extended Mac character set with things like the symbol for pi (I'm not typing that here because it may not be readable at your end)
>
> c) whatever is allowed in 'normal' PC apps like Microsoft Word
Wow: how I dislike the fact that 'PC' = 'PC running Windows'.
>
> c) full Unicode, derived from some display on a web site or elsewhere which simply operates in Unicode.
>
> I am prepared to do my manipulation entirely in Unicode, since in a way this is a superset of anything else I might have to handle (OK not quite, because the Mac has its own non-Unicode extended character set) - but my problem is, how am I to know what the text in the field consists of? Naively I think that some of the 'characters' will be single byte and some double, which makes everything look extremely uninterpretable, but maybe not.
>
> Can anyone suggest how to proceed with handling input like this? Can I just flag the input field as Unicode and relax? Probably not.
>
> TIA
>
> Graham
>
I have a feeling that, in your script that is either typed in or pasted
into, before either
the typing takes place or the pasting you must do a:
set the useUnicode to true
something like this, maybe, in the card script:
on keyDown
set the useUnicode to true
end rawKeyDown
wow; I just wrote a pile of stinking sh*t as that blocks the letter
input; similar probs with rawKeyDown.
ASCII is a subset of Unicode.
----------------------------------------------------
Why do you need "to know what the text in the field consists of" ?
Surely you only to know that if you are going to do "things" with the
text after chummy has typed/pasted/whatever the text?
I (on Linux) have just typed some 'goobledygook' using the Nepali
keyboard layout (looks suspiciously like Hindi Devanagari, and prob.
the only difference is some hairy-chested sort of Nepali nationalism),
and it entered the textField "just like that".
went here: http://www.doe.gov.np/ Lovely website; cannot understand a
single thing; but marvellous for trying copy-paste into
Livecode fields.
Copied and pasted a random paragraph; and it pasted looking exactly as
per the website.
So, certainly from the point of view of text-entry and/or pasting you
can 'relax'.
---------------------------------------------------
"flag the field as Unicode" ?
I wish I knew how to do that!
---------------------------------------------------
"relax" Ha, Ha, not a chance chum.
---------------------------------------------
I have just had one of those lovely day-dreams where I really Grokked on
this idea:
if fld "fTEXT" contains unicodeText then
put "Wow-zah"
end if
anyway . . .
apart from getting Tom Wolfe stuck between my teeth . . .
Nothing was PUT either with the pasted Nepali text, or when I had put a
unicode char into the fld like this:
set the useUnicode to true
set the unicodeText of fld "fTEXT" to numToChar(7891)
So . . . I'm not being much help really.
Richmond.
More information about the use-livecode
mailing list