- 論壇徽章:
- 0
|
Part D. 關(guān)于 Unicode
或許有些朋友對(duì)用 Perl 進(jìn)行 Unicode 編碼感興趣,補(bǔ)充兩個(gè)小程序。
在忘記密碼的環(huán)節(jié)里,郵件里的標(biāo)題依然是亂碼,這里提供了修正版。
1) 推薦代碼
type u1.pl {執(zhí)行時(shí)候請(qǐng)用 perl u1.pl 你好}
<----------
use Encode;
use Unicode::UCD 'charinfo';
$str=decode('gb2312',shift);
# 由于系統(tǒng)環(huán)境為gb2312,所以cmd后的中文參數(shù)也為
# gb2312編碼,因此告訴perl先把shift得到的參數(shù)按
# gb2312解碼成unicode
$a=charinfo(unpack 'U',$str);
for(keys %$a)
{
print "$_ ==> $a->{$_}\n";
}
---------->
type u2.pl {執(zhí)行時(shí)候請(qǐng)用 perl u2.pl 你好}
<----------
use Encode;
use Unicode::UCD;
$str=decode('GBK',shift);
# 由于系統(tǒng)環(huán)境為gb2312,所以cmd后的中文參數(shù)也為
# gb2312編碼,因此告訴perl先把shift得到的參數(shù)按
# gb2312解碼成unicode
$str = encode('MIME-Q', $str);
print $str;
---------->
2) 運(yùn)行結(jié)果
H:\Usr\bin>perl u2.pl 系統(tǒng)更改密碼請(qǐng)求
=?UTF-8?Q?=E7=B3=BB=E7=BB=9F=E6=9B=B4=E6=94=B9=E5=AF=86=E7=A0=81=E8=AF=B7?=
=?UTF-8?Q?=E6=B1=82?=
H:\Usr\bin>perl u2.pl 系統(tǒng)更改密碼請(qǐng)
=?UTF-8?Q?=E7=B3=BB=E7=BB=9F=E6=9B=B4=E6=94=B9=E5=AF=86=E7=A0=81=E8=AF=B7?=
H:\Usr\bin>perl u2.pl 請(qǐng)求
=?UTF-8?Q?=E8=AF=B7=E6=B1=82?=
3) 郵件模版
從上推斷出 template\cn\default\account\password\forgotten-password.txt.tmpl
[% PROCESS global/variables.none.tmpl %]
[% expiration_ts = token_ts + (max_token_age * 86400) %]
From: bugzilla-admin-daemon
To: [% emailaddress %]
Subject: [% terms.Bugzilla %]=?UTF-8?Q?=E7=B3=BB=E7=BB=9F=E6=9B=B4=E6=94=B9=E5=AF=86=E7=A0=81=E8=AF=B7=E6=B1=82?=
Content-Type: text/plain; charset="UTF-8"
Mime-Version: 1.0
系統(tǒng)更改密碼請(qǐng)求:
你(或者是其他的某個(gè)人)申請(qǐng)改變你的[%+ terms.Bugzilla %]密碼。
如果確認(rèn)這個(gè)改變,請(qǐng)?jiān)L問(wèn)下面的鏈接:
[%+ Param('urlbase') %]token.cgi?t=[% token FILTER url_quote %]&a=cfmpw
如果你不是這個(gè)請(qǐng)求的申請(qǐng)者,或者想放棄這個(gè)請(qǐng)求,請(qǐng)?jiān)L問(wèn)下面的鏈接:
[%+ Param('urlbase') %]token.cgi?t=[% token FILTER url_quote %]&a=cxlpw
如果你不進(jìn)行任何操作,那么在 [%+ max_token_age +%] 日
(即 [%+ time2str("%H:%M on the %o of %B, %Y", expiration_ts) -%]) 后,
或者在你下次成功登錄后,該申請(qǐng)將會(huì)自動(dòng)失效。
Part E. MySQL 故障
使用 Bugzilla 連接 MySQL 時(shí)會(huì)告訴你數(shù)據(jù)庫(kù)連接失敗,其實(shí)這是因?yàn)槊艽a算法更新了。
1) 參考網(wǎng)址
http://www.cnblogs.com/huqingyu/archive/2004/12/09/74989.html
http://www.kehui.net/html/article/39/39822.html
http://www.phpv.net/article.php/288
http://dev.mysql.com/doc/mysql/en/old-client.html
mysql4.1以上版本連接時(shí)出現(xiàn)Client does not support authentication protocol問(wèn)題解決辦法
2) 解決方案
C:\> mysql -u root -p
mysql> \u mysql
mysql> select user,host,password from user;
mysql> set password for 'bugs'@'localhost' = old_password('bugs');
mysql> set password for 'bugs'@'%' = old_password('bugs');
mysql> select user,host,password from user;
Part F. Perl 故障
1) 參考網(wǎng)址
http://www.bugzilla.org/docs/win32install.html
http://blog.csdn.net/emu/archive/2005/03/15/320326.aspx
在apache下發(fā)布了bugzilla
couldn't create child process — 原來(lái)是無(wú)法創(chuàng)建子過(guò)程?磥(lái)是沒(méi)有找到perl.exe。
2) 解決方案
把下面這個(gè)東西保存為 Perl.reg,然后鼠標(biāo)雙擊導(dǎo)入就可以了。請(qǐng)注意修改
安裝路徑 [HKEY_CLASSES_ROOT\.cgi\Shell\ExecCGI\Command]。
<-----------------------------------------------------
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.cgi]
@="ActivePerl"
[HKEY_CLASSES_ROOT\.cgi\Shell]
[HKEY_CLASSES_ROOT\.cgi\Shell\ExecCGI]
[HKEY_CLASSES_ROOT\.cgi\Shell\ExecCGI\Command]
@="H:\\Server\\Lang\\Perl\\bin\\perl.exe -T"
----------------------------------------------------->
[[i] 本帖最后由 wwashington 于 2006-9-6 00:44 編輯 [/i]] |
|