UCODEPAGE statement  

Purpose

Set the default codepage used for ANSI / UNICODE conversions.

Syntax

UCODEPAGE ANSI|OEM|NumExpr [TO PrevPage&]

Remarks

PowerBASIC will make many conversions between ANSI and UNICODE (wide character) strings.  UCODEPAGE specifies the CodePage to be used for these translations.  The default is UCODEPAGE ANSI which will use the system ANSI codepage for your computer.  UCODEPAGE OEM will use the system OEM codepage for your computer, while a numeric expression can specify a particular CodePage of your choice.

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 which codepage PowerBASIC should use for ANSI/UNICODE conversions.

By default, the system ANSI CodePage, 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 are compiling a CONSOLE application which makes use of the high-order ANSI codes, CHR$(128) through CHR$(255) for line drawing and a few international characters, you should declare an OEM CodePage by placing UCODEPAGE OEM at the start of your MAIN function.

The CodePage specification is maintained on a thread-by-thread basis. At program start, the default is the system ANSI CodePage.  If a new thread is launched, it inherits the CodePage in use by the main thread.

See also

ACODE$, UCODE$