Importing Unicode text to a field .. How?

Slava Paperno slava at lexiconbridge.com
Wed May 25 01:27:21 EDT 2011


By the way, you don't need this line:

set useUnicode to true

You only need that if you use charToNum() or numToChar()

Also keep in mind that after you convert your UTF8 text in the variable to UTF16 for the field, the length() function will return twice the length of your text. That's because length() returns the number of bytes, not the number of characters.

Slava

> -----Original Message-----
> From: use-livecode-bounces at lists.runrev.com [mailto:use-livecode-
> bounces at lists.runrev.com] On Behalf Of Sivakatirswami
> Sent: Wednesday, May 25, 2011 1:17 AM
> To: How to use LiveCode
> Subject: Re: Importing Unicode text to a field .. How?
> 
>   Namaste, Slava:
> 
> I tried that too, but I lose all the CR's...I get one long line in the
> LiveCode field, but if I paste it here into the email  the CRLF's come
> back!
> 
> Or if I copy from Pages.. the CR's are preserved...
> 
> If I try to process the CR in the usual way, I get them back in the
> field but the text becomes garbled again
> 
> on mouseup
>     answer file "Choose the Unicode for this song" with "OK"
>     put url ("binfile:/" & it) into tUnicode
>     set the useUnicode to true
>    set the unicodetext of  fld "Unicode_Script" to  tUnicode
> end mouseup
> 
> #  THE FOLLOWING IS A SINGLE LINE IN THE LC FIELD:
> 
> Converted from மயிலை text in
> /Users/sivakatirswami/Documents/Tamil/Natchintanai in Unicode/3 Thannai
> Thannaal.txt தன்னைத்தன்னால்தன்னைத் தன்னால் அறிந்திட
> வேண்டுமேதானா யெங்குஞ் செறிந்திட
> வேண்டுமே[snip]
> 
> on mouseup
>     answer file "Choose the Unicode for this song" with "OK"
>     put url ("binfile:/" & it) into tUnicode
>     set the useUnicode to true
>    set the unicodetext of  fld "Unicode_Script" to  tUnicode
>    replace numtochar(13) with numtochar(10) in fld "unicode_Script"
>     # the above line restores the line breaks but destroys the text...
> or rather, converts it to some other encoding displays Japanese
> characters
> end mouseup
> 
> C
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode






More information about the use-livecode mailing list