unicode

Devin Asay devin_asay at byu.edu
Tue Nov 21 10:04:23 EST 2006


On Nov 19, 2006, at 6:21 PM, Douglas Ivers wrote:

> Which unicode does Rev implement?  Is there a detailed spec for it?

As far as I can tell, it's just standard UTF-16, using the byte order  
of the host platform.

> Will Rev in the future offer other types of unicode?  Like UTF8?

I don't know much about future plans, except that unicode  
implementation will be significantly enhanced. UTF8 is supported now  
through use of the uniencode() and unidecode() functions. So, for  
example, if I want to import a UTF8 file, I would simply read it in  
(using a binary, not text, read) to a variable, then encode it to  
UTF16 like this:

on mouseUp
   answer file "Choose a UTF-8 file to read in."
   if it is empty then exit mouseUp
   put url ("binfile:" & it) into tRaw

   set the unicodetext of fld "display" to \
       uniencode(tRaw,"UTF8")
end mouseUp

Then when you want to write a unicode field out to UTF-8 do something  
like this:

on mouseUp
   ask file "Save file as..."
   if it is empty then exit mouseUp
   put "binfile:" & it into urlname
   put unidecode(the unicodeText of fld "typing","utf8") into url  
urlname
end mouseUp

Hope this helps.

Devin

Devin Asay
Humanities Technology and Research Support Center
Brigham Young University




More information about the use-livecode mailing list