Note that the default being ISO-8859-1 may not
make sense for all content types, e.g.
Content-Type: image/gif; charset=ISO-8859-1
In the above case you need to pass -charset => ''
to prevent the default being used.
####
# mycgi.pl
use CGI;
my $cgi = CGI->new;
print $cgi->header(
-type => 'application/vnd.ms-excel',
#-nph => 1,
-expires => '+3d',
#-charset => 'utf-8',
-charset => '',
-attachment => 'foo.xls',
);
# you need a foo.xls in your local dir
open (IMAGE, '<', 'foo.xls');
print ;
close IMAGE;
####
while true; do { echo -ne "HTTP/1.1 200 OK\r\n"; perl mycgi.pl; } | nc -l -k 8080; done