Unicode, the clipboard and LC fields

Graham Samuel livfoss at mac.com
Wed Jan 22 08:47:45 EST 2014


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

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





More information about the use-livecode mailing list