Hi all,
My cgi script using Html::Template having some error display Chinese
Character.
I have set character set to gb2312, and the encoding character set was
set to gb2312 too.
But in that case, the "你好" wasn't displayed as expected.
However, I found that if I change the encoding character set of my *
browser* to utf8, it displays perfectly.
Why ?
Most browsers in China were set to gb2312 encoding, I don't want users
to manually change their
default setting to view my page.
What can I do?
Thanks!!
cgi code:
##################################################
#!/usr/bin/perl -w
use CGI::Carp qw(fatalsToBrowser);
use CGI qw(:standard);
use HTML::Template;
my $template = HTML::Template->new(filename => 'title.tpl.php');
my $title = '你好';
$template->param('title' => $title);
*print header(-charset=>"gb2312");*
print $template->output;
template code:
##################################################
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="description" content="">
<meta name="keywords" content="">
<title><TMPL_VAR NAME=title></title>
</head>
<body>
<TMPL_VAR NAME=title>
<br>
Hello!
<br>
Hard code你好
</BODY>
</HTML>
Allen Zhang
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Html-template-users mailing list
Html-template-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/html-template-users