[Israel.pm] CGI and charset mistmatch

Shlomo Yona shlomo at cs.haifa.ac.il
Tue Jun 1 14:02:24 PDT 2004

Hello, Mongers.

I have a simple CGI script which is supposed to accept text
in ISO-8859-8 and return text also in ISO-8859-8.

The following CGI was supposed to do that, only that it
somehow inserts 
	<?xml version="1.0" encoding="iso-8859-1"?>
as the first text in the response content.
I suspect that this is CGI doing that, but I cannot seem to
be able to prevent it to or at least cause it to write
ISO-8859-8 instead. Any suggestions?

--- begin code snippet ---

 #!/home/yona/perl/bin/perl # perl 5.8.4

 use strict;
 use warnings;

 use Morphology::Analyzer qw/analyze/; 
 use Morphology::Analyzer::HTML qw/output_analysis/;

 use CGI;

 my $q = CGI->new;
 my $input = $q->param('input_text');
 print $q->header(-charset=>'ISO-8859-8'), 
				-http_equiv => 'Content-Type',
				-content=>"text/html; charset=ISO-8859-8"
	$q->h1('Analysis results');
print $q->end_html;

--- end code snippet ---


Shlomo Yona
shlomo at cs.haifa.ac.il

More information about the Perl mailing list