Russian (UTF-8) in LC 4.6
Mark Schonewille
m.schonewille at economy-x-talk.com
Sat May 7 20:40:33 EDT 2011
Hi Slava,
You can set the label but not the name of button to a unicode string. In LiveCode, you always use UTF16. If you have a UTF8 string, you need to convert it to UTF16 before you can use it in LiveCode. To convert a UTF8 string to UTF16, use the following syntax:
put uniEncode(myUTF8StringVar,"UTF8") into myUTF16StringVar
and to convert from UTF16 to UTF8 use
put uniDecode(myUTF16StringVar,"UTF8") into myUTF8StringVar
I think that it should be possible to assign a cyrillic string to a variable in a script, but it won't be easy. It is easier to keep your data in fields or custom properties.
There might be a LiveCode version that handles unicode text better in the future, but if you have to deliver a project anytime soon, I wouldn't wait for that new version.
Btw you can set the unicodeTitle of a stack.
--
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 8 mei 2011, at 02:24, Slava Paperno (Bridge) wrote:
> Is anyone using LC 4.6 for "really foreign" stacks, like Slavic languages or
> Greek, in UTF-8?
>
> In my tests of 4.6.1, the Contents box of fields and labels accepts Russian
> fine, and it is displayed correctly, but Russian in a button caption or
> tooltip turns into garbage (actually, it looks like it tries to display each
> byte of the two-byte characters, poor thing). Trying to type Russian in the
> code window totally bombs for me (the effect is indescribable).
>
> I'm new to LC, so I may be missing something crucial here. The phrase in the
> User Guide about writing your own functions to process strings sounds
> ominous, and yet they recommend the use of UTF-8, but again speak darkly of
> "implementing an external" if you wish to use string handling functions
> (section 6.4.6 on UTF-8).
>
> Can one even assign a Cyrillic string to a variable in the code window?
>
> I must be doing something wrong--or should I wait for another version of LC?
>
> Any tips will be appreciated,
>
> Slava
>
More information about the use-livecode
mailing list