Problem encoding csv file (PHP programming)
I'm developing an application that export some data to a csv file.
I use this code to encode my php script file:
header('Content-Type: text/html; charset=utf-8');
and this one to encode the database data:
$pgdb->query('SET CHARACTER SET latin1');
Later when I use this other for encode the download file:
header('Content-type: text/plain, charset= ISO-8859-1');
header('Content-Disposition: attachment; filename="digitalbank.csv"');
Well, I tried every combination of charsets, and always have problems when the data have specials chars, like spanish accented words...
I tried utf-8 codification, and ISO-8859-x, and never suceed in special chars representation.
I tried to change the transfer encoding
But still have this problem.
The strange thing is that in the web, data appears correctly.
But the download csv file, never appears like an ansi encoded file.
In notepad it seems to be near to correct representation, but this not happen in other edit applications that draw weird chars....
Anyone can help me please?
|All times are GMT +5.5. The time now is 22:56.|