error when reading file.txt!! why print a txt in Japanese?

 
why print a txt in Japanese?
Hi, I'm trying something that drove me crazy:

I have created a txt and I have put it in the folder "files"; I've called that txt "ab.txt"

void OnStart()
  {
//---   
      string copia="";
      int handle4=FileOpen("ab.txt",FILE_TXT|FILE_READ);

      if(handle4>0)
        {
         bool sigue=false;
         FileSeek(handle4,0,SEEK_SET);
         while(!sigue)
           {
            string a=FileReadString(handle4);
            Print(a);
            copia+=a;
            sigue=FileIsEnding(handle4);
           }
         FileClose(handle4);
        }
      Print("2 ",copia);
      Print("hi");
}

create the following script, with which I want to "read" it and when I execute it, it apparently locates the file, but when I want to print it, it shows me an unreadable result

Can you do tests and see if it just happens to me?
What can be?

NOTE: I have tried the same on MT4 and it works fine!

this is my system: 


and this is the strange result:


 
Miguel Antonio Rojas Martinez:
why print a txt in Japanese?
Hi, I'm trying something that drove me crazy:

I have created a txt and I have put it in the folder "files"; I've called that txt "ab.txt"


create the following script, with which I want to "read" it and when I execute it, it apparently locates the file, but when I want to print it, it shows me an unreadable result

Can you do tests and see if it just happens to me?
What can be?

NOTE: I have tried the same on MT4 and it works fine!

this is my system: 


and this is the strange result:


Play around with adding FILE_ANSI or FILE_UNICODE to:

      int handle4=FileOpen("ab.txt",FILE_TXT|FILE_READ);

Which flag works depend on what encoding your file was written in...

 
Seng Joo Thio :

Juega un poco agregando  FILE_ANSI o  FILE_UNICODE  a:

Las marcas que dependen de la codificación de su archivo fue escrita en ...

Perfect,  i put FILE_ANSI and run Perfectly

thank you very much.

It is very simple, I apologize for the creation of the thread. But I have one doubt

So why in MT4 do not need to put that flag and if it "works" right?

 
Miguel Antonio Rojas Martinez:

Perfect,  i put FILE_ANSI and run Perfectly

thank you very much.

It is very simple, I apologize for the creation of the thread. But I have one doubt

So why in MT4 do not need to put that flag and if it "works" right?

It's the default character set expected by mt4 and mt5.

mt4 expect ansi, which allows for 256 character types, whereas mt5 expects unicode, which takes up to 65,536 different character types. So you need to specifically state whether your file is ansi, in mt5, or else it'll assume it is unicode.

Reason: