Skip to content

Commit 514fce4

Browse files
MasonFIchriskacerguis
authored andcommitted
Added encode conversion to to_csv-function so that special characters are shown correctly in MS Excel. (chriskacerguis#818)
1 parent b0229a1 commit 514fce4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

application/libraries/Format.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,9 @@ public function to_csv($data = NULL, $delimiter = ',', $enclosure = '"')
378378

379379
// Close the handle
380380
fclose($handle);
381+
382+
// Convert UTF-8 encoding to UTF-16LE which is supported by MS Excel
383+
$csv = mb_convert_encoding($csv, 'UTF-16LE', 'UTF-8');
381384

382385
return $csv;
383386
}

0 commit comments

Comments
 (0)