Don't you want to convert utf-8 to utf-16, ... to uniEncode (it, "UTF16")?


Slava


Sent from my mobile so please excuse brevity and typos.

----- Reply message -----
From: "J. Landman Gay" <jac...@hyperactivesw.com>
To: "How to use LiveCode" <use-livecode@lists.runrev.com>
Subject: Importing Unicode text to a field .. How?
Date: Sat, May 28, 2011 1:10 am


On 5/27/11 9:55 PM, Web Admin Himalayan Academy wrote:
> nope... that replacement does nothing...
>
> on mouseup
> answer file "Choose the Unicode for this song" with "OK"
> if the result ="cancel" then exit mouseup
> set the useUnicode to true
> set the unicodetext of fld "Unicode_Script" to url ("binfile:/" & it)
> # result: Tamil appears fine, but all one line
>
> replace numtochar(13) with numToChar(8232) in fld "Unicode_Script"
> #does nothing
>
> end mouseup

It was close though. LiveCode uses ascii 10 instead of ascii 13 for line 
endings. Those are converted automatically when you paste, but not when 
you put text into a field by script. So just replace cr with unix line 
endings and it works:

on mouseUp
   set the textfont of fld 1 to "InaiMathi,Unicode"
   answer file "Choose the Unicode for this song" with "OK"
   if the result <>"cancel" then
     get url ("binfile:" & it)
     replace numtochar(13) with numtochar(10) in it
     set the unicodetext of fld 1 to it
   end if
end mouseUp

-- 
Jacqueline Landman Gay         |     jac...@hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to