``

Prev Menu Next

Unicode characters

OPTION CHARACTER MULTIBYTE
This option statement enables multi-byte Unicode characters.
The scope of this statement is the program unit where it is written. When this is written, the behavior of substring operations, POS-functions, CHR$-functions, ORD-functions, LEN-functions and CHARACTER INPUT statements are altered.

OPTION CHARACTER BYTE
This option statement disables multi-byte characters.
The scope of this statement is the program unit where it is written. Every byte is assumed to be a character even if its ordinal exceeds 127.
LEN function returns the byte length of the internal representation (UTF-8) .
Note that Full BASIC standardizes only characters of which ordinal is less than 128.
When you manipulate byte strings or a byte file, you must write these in the program units where substring operations, POS-functions, CHR$-functions, ORD-functions, LEN-functions or CHARACTER INPUT statements are used.
Note.The default state of OPTION CHARACTER can be changed at the menu Option - Comatibility - Unit of String manipulation.
Example.1

    10 OPTION CHARACTER multibyte
    20 LET s$="Ω"
    30 PRINT LEN(s$), ord(s$(1:1))
    40 END

Execution results are

     1                       937

Example.2

    10 OPTION CHARACTER byte
    20 LET s$="Ω"
    30 PRINT LEN(s$), ord(s$(1:1))
    40 END

Execution results are

     2                       206