Dar Scott dsc at swcp.com
Mon Sep 18 17:30:03 EDT 2006

On Sep 18, 2006, at 2:05 PM, Viktoras Didziulis wrote:

> Is it possible to set charset of text displayed in table field to  
> utf-8 or
> any other charset ? Where, how ?... I tried to: set the unicodeText  
> of field
> "fTable" to "file:unicode.txt". The first result was nonsence - all  
> rows
> condensed into a single row of mess (with utf-8). The second time,  
> the file
> was true Unicode (utf-16), it crashed the Revolution IDE (2.7.1, MS  
> Windows)
>  Apparently I have bad luck today, time to sleep and wait until  
> tomorow :-)

I don't know anything about table fields, but I have stuffed some  
unicode into ordinary fields, and maybe my experience will help.

You can get UTF-8 text with URL file:.  Use uniEncode() to convert  
that to host-order UTF-16.  Then stuff it into the field with 'set  

There are two byte-order schemes of UTF-16.  The Byte-Order-Mark  
(BOM) at the front indicates the order.  If the BOM is missing then  
the default is big-endian.

However, as usual, Microsoft ignores standards where convenient and  
acts shocked that others do not do things the correct Microsoft way.   
On Microsoft most UTF-16 files will be little endian even without a  
BOM.  (You can often save a file in MS utilities as UTF-16BE, but Mac  
line ends are automatically used.)

So to put a file like that (UTF-16) into a field, input with URL  
binfile:.  Note the binfile: this time.  You might need to convert  
the line ends to the Revolution line ends.  The easiest way is to  
convert to UTF-8 and then replace characters as you would with  
ordinary text and then convert back.  Then put it into the field with  
'set unicodeText'.

In either case, if you get something funny at the start of the field,  
there might be a BOM character at the front.  If you get this, then  
ask on this list concerning how to recognize and get rid of it.

I suppose one way to approach tables is to see how this works in  
everyday fields and then once you get that to work, try it on a table  
field and see if it explodes or melts.  (Hmmm.  If you try this on  
any of Scott Rossi's or Ken Ray's fields, they might actually explode  
or melt.)

Dar Scott
Dar Scott Consulting  and  Dar's Lab
8637 Horacio Place NE
Albuquerque, NM 87111

Lab, office, home:  +1 505 299 9497
Fax:                call above first
Skype:              ask

dsc at swcp.com

Computer programming

More information about the Use-livecode mailing list