MQL4 Codepage Usage

Overview

  • MQL4 uses the current Windows ANSI codepage (CP_ACP) by default for converting strings to char arrays and vice-versa.
  • Custom encodings can be specified as an additional parameter in CharArrayToString(), StringToCharArray(), and FileOpen() functions.
  • Codepage Constants

    | Constant | Value | Description | |-----------------|-------|-----------------------------------------------| | CP_ACP | 0 | Current Windows ANSI code page. | | CP_OEMCP | 1 | Current system OEM code page. | | CP_MACCP | 2 | Current system Macintosh code page (legacy). | | CP_THREAD_ACP | 3 | Windows ANSI code page for the current thread. | | CP_SYMBOL | 42 | Symbol code page. | | CP_UTF7 | 65000 | UTF-7 code page. | | CP_UTF8 | 65001 | UTF-8 code page. |

  • Non-listed codepages can be specified by their corresponding numerical code.
  • Related Functions

  • CharArrayToString()
  • StringToCharArray()
  • FileOpen()
  • Related Concepts

  • [File Opening Flags](/constants/io_constants/fileflags)
  • [File Properties](/constants/io_constants/enum_file_property_integer)
  • [In-File Position](/constants/io_constants/enum_file_position)
  • [MessageBox Constants](/constants/io_constants/messbconstants)
  • [Client Terminal Properties](/constants/environment_state/terminalstatus#enum_terminal_info_integer)