I want to create file with code "UTF-8", but the file is alway "UTF-16".

 
void OnStart()
 {
  int filehandle = FileOpen("fractals.csv", FILE_WRITE | FILE_CSV, '\t', CP_UTF8); //---> I set it UTF8
  if(filehandle != INVALID_HANDLE)
   {
    FileWrite(filehandle, TimeCurrent(), Symbol(), EnumToString(_Period));
    FileClose(filehandle);
    Print("FileOpen OK");
   }
 }

But the file is always "UTF-16":

Since I want to generate a lot of csv in utf-8, the conversion is not very convenient. I want to generate directly,  what should I do?

 

try to delete the original one before creating another one maybe the files are in conflict when you are trying to create them

FileDelete("fractals.csv");
<<  then >> 
file write code
 
Omega J Msigwa #:

try to delete the original one before creating another one maybe the files are in conflict when you are trying to create them

I do it , but it also UTF-16.  

 
Yu Zhang:

But the file is always "UTF-16":

Since I want to generate a lot of csv in utf-8, the conversion is not very convenient. I want to generate directly,  what should I do?

I changed it to FILE_ANSI and it worked when I tried - the documentation says it writes one byte symbols with this option

   int filehandle = FileOpen("fractals.csv", FILE_WRITE | FILE_ANSI, '\t', CP_UTF8); //---> I set it UTF8
 
In these situations, complexity comes at a benefit to the solution. I would consider the compatibility issues as well as the moral implications.

However, such problems are often solved by a simple syntax change in the programming. Just things to consider.
 
rms2256 #: In these situations, complexity comes at a benefit to the solution. I would consider the compatibility issues as well as the moral implications. However, such problems are often solved by a simple syntax change in the programming. Just things to consider.
What on earth are you rambling on about?