There are several gotchas that need to be fixed to make it work:
The MetaTrader uses fonts specified in the Windows settings. If the font doesn’t support Chinese characters, it will be displayed as “?” or squares. MT4 uses a “Message Box” group font for menu bars and panel titles, and it uses “Icon” group font for almost anything else. For example the messages panel where the EA logs are printed uses the “Icon” font. To change it on Windows 7 you need to go to “Control Panel” - “Personalization” - “Window Color” (at the bottom), then select “Item” group and choose a “Font”:
“Arial Unicode MS” is selected, because it has Chinese Unicode glyphs, but some other font that has them should work as well. It should to be selected for all groups, especially “Icon” and “Message Box”.
Even with the right fonts, when you choose the Chinese language in the MT4 “View” - “Language” the labels can be garbled. MT4 uses the current Windows locale for non-Unicode programs as the UI language. To change it in Windows 7 you need to go to “Control Panel” - “Region and Language” - “Administrative” - “Change system locale”:
After that restart Windows and you should get MetaTrader with the Chinese UI and messages.
The MQL scripts using Print
function should be working at this point.
int init() {
Print("utf8 ru привет = \x043F\x0440\x0438\x0432\x0435\x0442");
Print("utf8 cn 朋友你好 = \x670B\x53CB\x4F60\x597D");
return (0);
}
Finally, the “nquotes.mq4” file needs to be recompiled. Somehow the MT4 remembers an active locale in the “nquotes.ex4” at the time it was created. To recompile it just open “nquotes.mq4” in MetaEditor and hit F7 “Compile”. This file can be found in the “Experts” folder. Alternatively right-click it in the navigator list of EAs, choose “Edit”, and then “Compile”.
In the end it works like this:
Those lines were printed with this C# code using NQuotes:
public override int init() {
Print("utf8 привет = \u043F\u0440\u0438\u0432\u0435\u0442");
Print("utf8 朋友你好 = \u670B\u53CB\u4F60\u597D");
return 0;
}