Skip to content

Use of a Codepage

Using a Codepage in String Conversion Operations

When converting string variables into arrays of char type and back, the encoding that by default corresponds to the current ANSI of Windows operating system (CP_ACP) is used in MQL5. If you want to specify a different type of encoding, it can be set as additional parameter for the CharArrayToString(), StringToCharArray() and FileOpen() functions.

The table lists the built-in constants for some of the most popular code pages. Not mentioned code pages can be specified by a code corresponding to the page.

Built-in Constants of Codepages

ConstantValueDescription
CP_ACP0The current Windows ANSI code page.
CP_OEMCP1The current system OEM code page.
CP_MACCP2The current system Macintosh code page.
Note: This value is mostly used in earlier created program codes and is of no use now, since modern Macintosh computers use Unicode for encoding.
CP_THREAD_ACP3The Windows ANSI code page for the current thread.
CP_SYMBOL42Symbol code page
CP_UTF765000UTF-7 code page.
CP_UTF865001UTF-8 code page.

See also

Client Terminal Properties

Last updated on