How to set charset to gb2312
Many readers don't install Chinese software on their PC. Instead, they use
Microsoft Explorer 5.0's (or higher) "Encoding" feature to view Chinese (GB
or Big5).
When MS Explorer loads a page it checks the "charset" to determine what
language should be used to display the page. If the charset is not set,
MS Explorer will display in the defualt language, usually English, thus Chinese
charactors will show up as symbols and "Greek" letters. In such case the users
have to manually set the encoding to "Chinese Simplified". MS Explorer does have
ability to remember user's choice, so next time it will display the page in
Chinese.
In order for the MS Explorer to always display forum pages in Chinese, Please
modify following section of Perl script "mainpage.pl":
Old Code:
==========================================================================
###############################
# Main WWWBoard Page Subroutine
sub main_page {
open(MAIN,"$basedir/$mesgfile") || die $!;
@main = <MAIN>;
close(MAIN);
print "Content-type: text/html\n\n";
$index_flag = 0;
$line_counter = 0;
$ul_flag = 0;
$disp_flag = 0;
$pageno = $FORM{"pageno"};
if (!$pageno) { $pageno = 1;}
$pageno_next = $pageno + 1;
$pageno_prev = $pageno - 1;
if ($pageno_prev < 1) { $pageno_prev = 1; }
print "<html> \n";
print "<head> \n";
print "<title>论坛</title> \n";
print "</head> \n";
print "<body bgcolor=\"E5E5E5\"> \n";
...
==========================================================================
New Code:
==========================================================================
sub main_page {
open(MAIN,"$basedir/$mesgfile") || die $!;
@main = <MAIN>;
close(MAIN);
print "Content-type: text/html\n\n";
$index_flag = 0;
$line_counter = 0;
$ul_flag = 0;
$disp_flag = 0;
$pageno = $FORM{"pageno"};
if (!$pageno) { $pageno = 1;}
$pageno_next = $pageno + 1;
$pageno_prev = $pageno - 1;
if ($pageno_prev < 1) { $pageno_prev = 1; }
print "<html> \n";
print "<head> \n";
print "<META HTTP-EQUIV=\"content-type\" CONTENT=\"text/html; charset=gb2312\"> \n";
print "<title>论坛</title> \n";
print "</head> \n";
print "<body bgcolor=\"E5E5E5\"> \n";
...
==========================================================================
Please modify following section of Perl script "mainboard.pl":
Old Code:
==========================================================================
#####################
# New File Subroutine
sub new_file {
open(NEWFILE,">$basedir/$mesgdir/$num\.$ext") || die $!;
print NEWFILE "<html>\n";
print NEWFILE " <head>\n";
print NEWFILE " <title>$subject</title>\n";
print NEWFILE " </head>\n";
print NEWFILE " <body bgcolor=\"E5E5E5\">\n";
print NEWFILE " <center>\n";
print NEWFILE " <h2>$subject</h2>\n";
print NEWFILE " </center>\n";
print NEWFILE "<hr size=7 width=75%>\n";
...
==========================================================================
New Code:
==========================================================================
sub new_file {
open(NEWFILE,">$basedir/$mesgdir/$num\.$ext") || die $!;
print NEWFILE "<html>\n";
print NEWFILE " <head>\n";
print NEWFILE "<META HTTP-EQUIV=\"content-type\" CONTENT=\"text/html; charset=gb2312\"> \n";
print NEWFILE " <title>$subject</title>\n";
print NEWFILE " </head>\n";
print NEWFILE " <body bgcolor=\"E5E5E5\">\n";
print NEWFILE " <center>\n";
print NEWFILE " <h2>$subject</h2>\n";
print NEWFILE " </center>\n";
print NEWFILE "<hr size=7 width=75%>\n";
...
==========================================================================
You also need to change all html files, such as addnew.html, registor.html
Old Code:
==========================================================================
<html>
<head>
<title>加新贴</title>
</head>
<body bgcolor="E5E5E5">
...
==========================================================================
Now Code:
==========================================================================
<html>
<head>
<META HTTP-EQUIV="content-type" CONTENT="text/html; charset=gb2312">
<title>加新贴</title>
</head>
<body bgcolor="E5E5E5">
...
==========================================================================