UCODEPAGE statement  

Purpose

Set the default codepage used for ANSI / UNICODE conversions.

Syntax

UCODEPAGE numexpr [TO prevpage&]

Remarks

At times, it is necessary to convert string from the standard ANSI format to UNICODE format and vice-versa.  PowerBASIC may do so internally, or you may use ACODE$() and UCODE$() explicitly. By default, the system codepage for your computer is used to map the character translation, and this generally works very well, as it represents the usual codepage for your primary language.  However, if you need a special codepage for your own puposes, this statement may be used to define which one should be used by default.  Of course, if you specify an explicit codepage number in ACODE$() or UCODE$(), it will take precedence over this default value.

If the optional TO clause is used, the number of the previous default codepage is assigned to the long integer variable specified by prevpage&.  By saving the previous codepage, you can later restore it, if that's appropriate.

This statement does not change the codepage in use by your computer. It tells what codepage should be used by default for ANSI/UNICODE conversions.

Unicode strings require two bytes to represent a Unicode character, whereas ANSI strings (the native PowerBASIC string format) use one byte (or sometimes more) to represent a character.

See also

ACODE$, UCODE$