About CharToNum and Unicode...

Dar Scott dsc at swcp.com
Sat Jul 24 23:36:03 EDT 2004


On Jul 24, 2004, at 6:01 PM, Andre Garzia wrote:

> put "made with revolution ™" into tInitialValue
>  set the useUnicode to true
>   repeat  with i = 1 to the length of tInitialValue
>     put char i of tInitialValue into tChar
>     put CharToNum(tChar) into tChar
>     put baseconvert(tChar, 10, 16) into tChar
>     put tChar into tArrayA[i]
> end repeat

Well, Revolution has not moved that far into unicode.

You will get your host encoding tm.

Even when we talk about unicode.  A char is a byte, just 8 bits.

The simple view of unicode by Revolution, at this time, is two bytes in 
host order.  For charToNum() that simply means that it looks at the 
first two char (bytes) of the arg to calculate the value, when 
useUnicode is true.  Otherwise, it is the normal way; it looks at the 
first byte (char) only.

Unicode support is in the ability to work with fields, some conversion 
functions that work on strings as byte sequences that encode Unicode, 
and the two-byte modifier for chartoNum.

My dream is that someday we would be able to work with chars as chars 
with unicode as the basis and still be able to work with strings as 
byte sequences.  I don't know if there is much hope for that.

Dar Scott



More information about the use-livecode mailing list