CharToNum Depricated??

Niggemann, Bernd Bernd.Niggemann at uni-wh.de
Sun Sep 15 14:50:16 EDT 2024


Hi Bob,

charToNum has been deprecated, I think since LC 7.0

It is replaced by nativeCharToNum() and byteToNum

(As of LC 10.0.0 charToNum maps to nativeCharToNum, see release notes)

This covers the ASCII range.

For unicode you use codepointToNum()

I suspect that the small difference you see in file size is a Byte Order Mark, BOM at the beginning of the Konica Minolta address book.

You could try to use "open file" to import the Konica Minolta address book.

open file tFilePath for read
read from file tFilePath until EOF
put it into tData
close file tFilePath

The dictionary states

>From 7.0, it's possible to specify an encoding for the file being
opened. By doing so, you can straight read or write to a file without
having to call textEncode or textDecode; the encoding supported by
open file are the same as these text encoding functions. If no encoding
is provided, then open file tries to read a Byte Order Mark (BOM) exists
at the beginning of the file. In success, the encoding is adapted and the
BOM is ignored.


If my assumption that there is a BOM is correct then after opening and reading from the file should give you the same length of the data since the BOM is not part of the data.
I guess that is also the reason why SublimeText sees both files as identical. It probably also ignores the BOM.

I am just guessing and I am not an expert for these matters but maybe this gives you an idea to try.

Kind regard
Bernd


Bob wrote

Also, if charToNum is deprecated, what do I use to compare t he ascii values of
two characters??



More information about the use-livecode mailing list