Importing Unicode text to a field .. How?

J. Landman Gay jacque at hyperactivesw.com
Sat May 28 01:10:20 EDT 2011


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         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list