Cyrillic input

Slava Paperno slava at lexiconbridge.com
Tue May 31 10:26:17 EDT 2011


Also, you may want to examine the first two bytes of the data you get from
the UTF-8 file. Some Windows applications (like Notepad or Dreamweaver) put
a BOM (byte-order marker) at the beginning of the file. This is a two-byte
sequence, decimal 255 followed by 254, or decimal 254 followed by 255. You
may want to get rid of them before processing your string any further.

By the way, for a UTF-16 string, which is what you will have in the field,
function length() returns the number of bytes, not characters. And to access
a specific character in the field you need to use "char N to char N+1."

If you need to do any processing of that string and use chunk expressions
and such, convert the data in field back to UTF-8, do your processing, then
before putting it back into the field, convert it to UTF-16 again as Mark
said.

I'm just discovering these things as I'm trying to build a front end to a
Russian-English dictionary database. Haven't played with password input yet.

Slava

> -----Original Message-----
> From: use-livecode-bounces at lists.runrev.com [mailto:use-livecode-
> bounces at lists.runrev.com] On Behalf Of Mark Schonewille
> Sent: Tuesday, May 31, 2011 4:42 AM
> To: How to use LiveCode
> Subject: Re: Cyrillic input
> 
> Malte,
> 
> First:
> 
> put uniEncode(someDataFromFile,"UTF8") into myData
> set the unicodeText of fld x to myData
> 
> Then a few possibilities:
> 
> set the textfont of fld x to "SomeFont,Unicode"
> 
> (may have some unexpected side-effects) or
> 
> set the textFont of char 1 to -1 of fld x to "SomeFont,Unicode"
> 
> (may cause the input method back to English or other unwanted
> languages)
> 
> If a field is to be edited, you might want to try
> 
> set the textFont of fld x to "SomeFont,Cyrillic"
> 
> because this causes the input method to switch to Cyrillic (if no bugs
> are encountered).
> 
> I have just noticed that using non-english methods with password fields
> indeed causes trouble. Perhaps you need to catch the keyDown message or
> the rawKeyDown message and do everything manually. It might be useful
> to have a look at my password field (on my homepage) even though it
> doesn't work with Cyrillic (yet).
> 
> --
> Best regards,
> 
> Mark Schonewille
> 
> Economy-x-Talk Consulting and Software Engineering
> Homepage: http://economy-x-talk.com
> Twitter: http://twitter.com/xtalkprogrammer
> KvK: 50277553
> 
> New: Download the Installer Maker Plugin 1.6 for LiveCode here
> http://qery.us/ce
> 
> On 31 mei 2011, at 10:22, Malte Brill wrote:
> 
> > Hi all,
> >
> > for the first time I need to deal with cyrillic input (and reading
> from text files) in liveCode. Now I am a bit stumped.
> >
> > When I switch my keyboard to russian, the text field does seem to
> automagically recognize that I am typing in cyrillic. The glyphs show
> up. So far so good. If I now try to feed the field from a text file
> (encoded in UTF-8) I fail miserably. The text does not show up. What do
> I need to do to make this work?
> >
> > Next problem. I have scriped some password fields. These work fine
> for normal ASCII. I just set the imagesource for each char and this is
> ok.
> > However, as soon as I use cyrillic input, rawkeydown does not seem to
> fire anymore. If I then try to hide my glyphs that have been input, I
> end up with 2 imagesources per glyph (which is sensible, as each char
> is made up of 2 bytes.)
> >
> > Has anybody tackled situations similar to this? Any pointers much
> appreciated.
> >
> > Malte
> http://lists.runrev.com/mailman/listinfo/use-livecode






More information about the use-livecode mailing list