how do i force to set charset while writing to a file setting charset 1256 in php i have some data in sql which reads as ÇáÓáÇã Úáíßã æÑÍãå Çááå æÈÑßÇÊå and i am trying to convert it into correct (Arabic) format charset Windows-1256
my code is
$text = "ÇáÓáÇã Úáíßã æÑÍãå Çááå æÈÑßÇÊå";
$file = fopen("test.txt","w");
fwrite($file, $text);
fclose($file);
it saves the data same as it is although it display in correct format on browser i want to save it into text or maybe CSV as السلام عليكم ورحمه الله وبركاته يا اخوان هذا الفيروس which is its correct format