Skip to content
Advertisement

CSV Wrong Encoding

I have an array composed by just numbers and I use the following script to export in CSV

JavaScript

The result is in the following image

Here a dump of the given array

JavaScript

Any suggestion?

Advertisement

Answer

Check the encoding of $_SESSION[‘report’] data. It is possible that it uses some multi-byte characters. Use iconv on your $line before passing it to fputcsv function.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement