FILE_ANSI vs FILE_UNICODE

 

Hello guys

I am working with read/write bin files and would like to know advantages and disadvantages of using FILE_ANSI vs FILE_UNICODE

MQL5 documentation doesnt provide any detailed documentation except one/two byte symbol usage. 

 

Do you understand the meaning of ANSI and UNICODE ?

There are no advantages or disadvantages, you just use the one you need.

 
Alain Verleyen:

Do you understand the meaning of ANSI and UNICODE ?

There are no advantages or disadvantages, you just use the one you need.

Sorry, I though it is obvious that I am asking about example scenarios when ANSI is better than UNICODE or vice versa. 

In other word, when it is recommended to use ANSI instead of UNICODE or vice versa. 

In other word how to determine which one do I need, what are the criterias. 

In other word, is there any scenario when one or other can cause error while reading/writing (file format, type of variable for read or write, type destination/source array used for file read/write etc). 

 

Narek Kamalyan:

In other word, when it is recommended to use ANSI instead of UNICODE or vice versa. 

In other word how to determine which one do I need, what are the criterias.

  1. Do you need to write a character beyond the (255) ANSI set? Then you need Unicode.
  2. Do you have software that can only read ANSI? Then Unicode isn't valid.
  3. Do you need snow tires? Could you possibly be driving in snowy conditions? Only you know your requirements.
 
It controls how FlieWriteString() will encode text strings to binary bytes, either as Ansi (1 byte per characte) or unicode. The same thing also for FileReadString(), how it decodes the bytes from Bin file. 
 
amrali:
It controls how FlieWriteString() will encode text strings to binary bytes, either as Ansi (1 byte per characte) or unicode. The same thing also for FileReadString(), how it decodes the bytes from Bin file. 

This question arised becuase I am facing a strange issue. I used UNICODE in my code and it worked fine until I didnt switch to another broker terminal and read/write string stopped to work, i.e. when write dynamic array and read, all string values became empty. When I switched to ANSI it seems to work on both terminals.

Also another strange thing, when I switched to ANSI, in the new terminal it keeps working incorrectly until I didint restart the terminal. 

 
Narek Kamalyan: read/write string stopped to work,

“Doesn't work” is meaningless — just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires — meaningless.
     How To Ask Questions The Smart Way. 2004
          When asking about code

Do you really expect an answer? There are no mind readers here and our crystal balls are cracked. Always post all relevant code (using Code button).
     How To Ask Questions The Smart Way. 2004
          Be precise and informative about your problem

We can't see your broken code.

Fix your broken code.

 
William Roeder:

What I want to say is when I use UNICODE to write and read dynamic structure array to and from file, it works in some terminals and doesnt work on other, all of them latest June version. When I say doesnt work, I mean after write and read to/from file, ArrayPrint shows empty elements for all strings. When use ANSI it works. I didnt post any code becuase the problem I have seen on some terminals only, so I am expecting to understand the concept behind this rather than looking for someone to fix my code, I know about No Free Help

The question is:

There can be difference how different broker terminals are processing such basic functions?

Anyone faced such issue before.

 
Have you ever considered using binary as your way to go?

Why would you want to define the content/data if there is no need for doing it.

Write the memory to file, read the file to memory....

Shouldn't that solve the issue?

Especially when dealing with MB strings, just go binary for all functions not processing the interpreted content. This will save you a bunch of hazel.
 
Dominik Egert:
Have you ever considered using binary as your way to go?

Why would you want to define the content/data if there is no need for doing it.

Write the memory to file, read the file to memory....

Shouldn't that solve the issue?

Especially when dealing with MB strings, just go binary for all functions not processing the interpreted content. This will save you a bunch of hazel.
In my case I am writing array to bin file and read from it. But I believe you mean another thing by saying write memory to file.