采用《刑法》
#!/usr/bin/perl
use strict;
use warnings;
use CGI ":all";
use Encode;
my $cgi = new CGI;
$cgi->charset( utf-8 );
print $cgi->header(-type => text/html ,
-charset => utf-8 );
print $cgi->start_html(-title => Test ,
-head => meta({-http_equiv => Content-Type ,
-content => text/html; charset=utf-8 }));
my $text = test ; # for now
Encode::from_to($text, latin1 , utf8 );
print $cgi->p($text);
print $cgi->end_html;
我正在取得以下产出:
Content-Type: text/html; charset=utf-8
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
<head>
<title>Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<p>test</p>
</body>
而我不知道为什么这样,为什么我不知道为什么为什么为什么为什么为什么?
<meta http-equiv=“Content-Type” content=“text/html;charset=iso-8859-1”/>
产出不变,我不知道如何删除。
欢迎所有建议。