Php CSV export UTF8 encoding causing incorrect excel format -


i tired doing csv export. needed 2 languages (tamil , english) in sheet using normal headers

    $now = gmdate("d, d m y h:i:s");     header("expires: tue, 03 jul 2001 06:00:00 gmt");     header("cache-control: max-age=0, no-cache, must-revalidate, proxy-revalidate");     header("last-modified: {$now} gmt");     header ( 'content-type: application/vnd.ms-excel') ;     header("content-disposition: attachment;filename={$filename}");     header("content-transfer-encoding: binary");     echo $content; 

this causing problems in tamil characters being displayed. format of excel fine. used utf8 encoding display tamil characters shown below.

    $now = gmdate("d, d m y h:i:s");     header('pragma: public');     header("expires: tue, 03 jul 2001 06:00:00 gmt");     header('cache-control: must-revalidate, post-check=0, pre-check=0');     header("last-modified: {$now} gmt");     header('content-type: text/csv');     header("content-disposition: attachment;filename={$filename}");     header("content-transfer-encoding: binary");     echo chr(255) . chr(254) . mb_convert_encoding($content, 'utf-16le', 'utf-8'); 

this helped characters , both languages being displayed fine format of csv being generated disrupted. being displayed in single column. there anyway solve this?


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -