exportar matriz con contenido árabe a archivo de Excel php

i tried to export file from php array contain Arabic characters to Excel file. it works fine but the content of the Excel file not correct for example: the value of Array[0]='محمود' in the Excel file it display ط§ظ„ظƒظ„ظ‰ and it's not related to any Unicode, so here is my code:

$fallbackfilename = mb_convert_encoding($fileName, "ISO-8859-1"); 
$encodedfallbackfilename = rawurlencode($fallbackfilename);
$encodedfilename = rawurlencode($fileName);
header("Content-Disposition: attachment; filename=". $encodedfallbackfilename ."; filename*=windows-1256 $encodedfilename");

$header = array("المعرف", "الإسم", "التخصص", "رقم إذن العمل ", "حالة الحساب", "الهاتف الثابت", "الهاتف المتنقل", "عدد المشاهدات", "تاريخ الاضافة", "التخصص", "الدولة", "المدينة");

$fp = fopen("php://output", "w");
fputcsv($fp, $header, "\t");
foreach ($unsetElementsArray as $row) {
    fputcsv($fp, $row, "\t");

i'm sure i have a problem in the encabezamiento

Gracias por su atención.

preguntado el 12 de febrero de 14 a las 08:02

Perhaps if you tried writing to an actual Excel (BIFF or OfficeOpenXML format) file, rathe rthan to a CSV file, then you wouldn't be subjected to the vagaries of csv-handling across different applications and platforms -

AFAIK Excel chupa at dealing with UTF-8 csv. -

Most CSV readers suck at dealing with UTF-8 csv -

0 Respuestas

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.