BOM Problems

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nc3b
Forum Newbie
Posts: 3
Joined: Mon Nov 06, 2006 5:31 am

BOM Problems

Post 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 :)
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

try specifying the charset in your content type header:

Code: Select all

header('Content-Type: text/x-csv; charset=UTF-8');
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

.csv content type is text/csv, by the way. :)
Post Reply