MQL4 Reference Checkup MQLSetInteger


Sets the value of the MQL_CODEPAGE property in an MQL4 program environment.

void  MQLSetInteger(
   int  property_id          // identifier of a property
   int  property_value       // value to be set



[in]  Identifier of a property. Only MQL_CODEPAGE is supported, as other properties cannot be changed.


[in]  Value of property. Can be one of the Codepage constants.

Return Value

No return value


The MQLSetInteger() function is intended to change current codepage in a running MQL4 program. This can be useful when the client terminal sets the default codepage that is different from the one used when the program was compiled. For example, an MQL4 program was compiled on a computer with Spanish locale, while it is running on a machine with Chinese locale.

When locales of machines the program was compiled and is running on are different, you can get errors when printing messages or getting some values. Such errors relate to the PrintFormat, Print, Comment, Alert, MessageBox, SendFTP, SendMail, SendNotification, iCustom and other functions that use object names, global variable names, etc. as their parameters.

To explicitly change a codepage to work with strings in a running program, you need to call MQLSetInteger() with required codepage passed as its second parameter. The function can be particularly useful for localization of messages displayed to user.

See also

Use of a Codepage