MQL4 - MQLInfoInteger(MQL_CODEPAGE) always returns 0 - page 2

 

I tested few code pages including: 1252,1250,437,852,850, however I can't get proper outcome with any.

what's the way to verify what code page has been used when compiling EA so then it could be used on the other machine?


for example machine2 log with codepage 1252 attempt, 

0    21:37:33.966    My_EA_v1.20 ETHUSD(Ł),H1: MQLInfoInteger(MQL_CODEPAGE) on Init: 0
0    21:37:33.966    My_EA_v1.20 ETHUSD(Ł),H1: Symbol() on Init: ETHUSD(L)
0    21:37:33.966    My_EA_v1.20 ETHUSD(Ł),H1: changing to codepage: 1252
0    21:37:33.966    My_EA_v1.20 ETHUSD(Ł),H1: MQLInfoInteger(MQL_CODEPAGE) after codepage change: 0
0    21:37:33.966    My_EA_v1.20 ETHUSD(Ł),H1: Symbol() after codepage change: ETHUSD(L)

and still getting error with order opening 4106 unknown symbol.


pay attention to line header: ETHUSD(Ł),H1 matches symbol from the instruments list, however Print Symbol() already prints it wrong no matter codepage I set. 

 
BaronWawelski:

I tested few code pages including: 1252,1250,437,852,850, however I can't get proper outcome with any.

what's the way to verify what code page has been used when compiling EA so then it could be used on the other machine?


for example machine2 log with codepage 1252 attempt, 

0    21:37:33.966    My_EA_v1.20 ETHUSD(Ł),H1: MQLInfoInteger(MQL_CODEPAGE) on Init: 0
0    21:37:33.966    My_EA_v1.20 ETHUSD(Ł),H1: Symbol() on Init: ETHUSD(L)
0    21:37:33.966    My_EA_v1.20 ETHUSD(Ł),H1: changing to codepage: 1252
0    21:37:33.966    My_EA_v1.20 ETHUSD(Ł),H1: MQLInfoInteger(MQL_CODEPAGE) after codepage change: 0
0    21:37:33.966    My_EA_v1.20 ETHUSD(Ł),H1: Symbol() after codepage change: ETHUSD(L)

and still getting error with order opening 4106 unknown symbol.


pay attention to line header: ETHUSD(Ł),H1 matches symbol from the instruments list, however Print Symbol() already prints it wrong no matter codepage I set. 

That's a weird symbol name. I thought it was with ' £ '  ?

Which broker server is it ?

 

ETHUSD(Ł),H1 is on machine2

ETHUSD(£), H1 is on machine1


it depends on OS codepage.

 
BaronWawelski:

ETHUSD(Ł),H1 is on machine2

ETHUSD(£), H1 is on machine1


it depends on OS codepage.

What's windows versions do you use in both cases? Which locales?

 

machine1- english(united kingdom), win7

machine2 - polish, win10


it seems there is no way for MT4 not to recompile EA and make it work...

also MQLInfoInteger(MQL_CODEPAGE) will always return 0 and there is no use case for it.


Can you confirm please?

 
BaronWawelski:

machine1- english(united kingdom), win7

machine2 - polish, win10


it seems there is no way for MT4 not to recompile EA and make it work...

also MQLInfoInteger(MQL_CODEPAGE) will always return 0 and there is no use case for it.


Can you confirm please?

As we are not MQ stuff we can't confirm or deny that it fails and why. Meanwhile, I have 2 propositions.

1) Try to compile your file in MT5's metaeditor (I'm not sure the latest versions will make compatible code with MT4, then you should get MT5 1816 somehow), then copy resulting ex4 to MT4 and try if it works differently.

2) Try to change MT4 language:


 

This code works for me:

  MQLSetInteger(MQL_CODEPAGE, CP_UTF8);
  Print("£Ł");

Outputs "£Ł" in log (if viewed as widechar).

 
Stanislav Korotky:

This code works for me:

Outputs "£Ł" in log (if viewed as widechar).

yes,  I do confirm you can change codepage however when I change it to 850 instead of CP_UTF8 it is not 850 codepage in the end (perhaps hexa value should be passed as argument?)

also changing regional settings of the OS as you advised resolves the need of non-recompiling (however brings some other small downsides).

also the other conclusion is that MQLInfoInteger(MQL_CODEPAGE) is useless.

thanks

Reason: