Page 1 of 1

BOM Problems

Posted: Fri Jan 26, 2007 10:50 am
by nc3b
Hello. I need to send a file to a user, so I use

header("Content-type: text/x-csv");
header("Content-Disposition: attachment; filename=whatever");
header("Pragma: no-cache");
header("Expires: 0");

But as the three bytes it send EF BB BF which is Byte Ordering Mark, UTF-8. Or so I hear. These characters look like junk for a plain editor, not ready for UTF-8. It drives me nuts. Can you help? Thank you :)

Posted: Fri Jan 26, 2007 11:39 am
by Kieran Huggins
try specifying the charset in your content type header:

Code: Select all

header('Content-Type: text/x-csv; charset=UTF-8');

Posted: Fri Jan 26, 2007 1:52 pm
by feyd
.csv content type is text/csv, by the way. :)