I use this to add BOM: http://search.cpan.org/~lyokato/UTF8BOM-1.01/lib/UTF8BOM.pm You shouldn't be so fixed on eliminating BOMs, it's quite a nice concept. It causes less trouble than you think.