openwebmail 2.53版 問題修正紀錄
雖然openwebmail 現有 Current Development Site 還在修正 Bugs
但是裝上去之後對中文字還是會有不太相容的問題…
所以只好一個一個解決現有的問題了
通訊錄亂碼:
這個部份可以參考我以前學校的師父的說明 http://phorum.study-area.org/index.php?topic=50495.0#msg275602
1. 編輯你的語系裡的 composemessage.template 檔
vi cgi-bin/openwebmail/etc/templates/zh_TW.Big5/composemessage.template
2. 找到下列的程式碼
url += "&to=" + escape (document.composeform.to.value); url += "&cc=" + escape (document.composeform.cc.value); url += "&bcc=" + escape (document.composeform.bcc.value);
3. 將上面這3行改成下面這樣
url += "&to=" + document.composeform.to.value; url += "&cc=" + document.composeform.cc.value; url += "&bcc=" + document.composeform.bcc.value;
所見即所得編輯器在IE6無法啟動:
2.53版使用的編輯器是HTMLArea 3.0 Beta
這版在IE6會無法啟動…
所以只要當內文是html格式..
會無法轉換,變成直接顯示html原始碼
google了一下…好像也沒有patch可以修正..
索性直接換掉這套古老的編輯器 …
Dev版是使用xinha…
在trace 後發現他改了太多架構…
so…就換成我習慣使用的FCKeditor
這套編輯器支援相當多常用的程式語言…
對瀏覽器的相容性也很高…
這次要使用js載入的方式來做
將下載完的檔案解壓縮後上傳到javascript/
設定fckconfig.js
再來就是要改 openwebmail-send.pl
找到 if ($_htmlarea_css_cache eq ") {
將以下程式刪除
if ($_htmlarea_css_cache eq '') {
sysopen(F, "$config{'ow_htmldir'}/javascript/htmlarea.openwebmail/htmlarea.css", O_RDONLY) or
openwebmailerror(__FILE__, __LINE__, "$lang_err{'couldnt_read'} $config{'ow_htmldir'}/javascript/htmlarea.openwebmail/htmlarea.css! ($!)");
local $/; undef $/; $_htmlarea_css_cache=<F>; # read whole file in once
close(F);
}
my $css = $_htmlarea_css_cache;
$css =~ s/\@\@\@BGCOLOR\@\@\@/$style{'window_light'}/g;
$css =~ s/"//g;
再將以下程式做替換
$html= qq|<script language="JavaScript" src="$config{'ow_htmlurl'}/javascript/htmlarea.openwebmail/htmlarea.js"></script>\n|.
qq|<script language="JavaScript" src="$config{'ow_htmlurl'}/javascript/htmlarea.openwebmail/dialog.js"></script>\n|.
qq|<script language="JavaScript" src="$config{'ow_htmlurl'}/javascript/htmlarea.openwebmail/popups/$htmlarealocale/htmlarea-lang.js"></script>\n|.
$html.
qq|<style type="text/css">\n$css\n</style>\n|.
qq|<script language="JavaScript">\n<!--\n|.
qq| var editor=new HTMLArea("body");\n|.
qq| editor.config.editorURL = "$config{'ow_htmlurl'}/javascript/htmlarea.openwebmail/";\n|.
qq| editor.config.imgURL = "images/";\n|.
qq| editor.config.popupURL = "popups/$htmlarealocale/";\n|.
qq| editor.config.bodyDirection = "$direction";\n|.
qq| editor.config.attlist = {\n$htmlarea_attlist_js};\n|.
qq| editor.config.attlist = {\n$htmlarea_attlist_js};\n|.
qq| editor.generate();\n|.
qq|//-->\n</script>\n|;
換成
$html= qq|<script language="JavaScript" src="$config{'ow_htmlurl'}/javascript/fckeditor/fckeditor.js"></script>\n|.
$html.
qq|<script language="JavaScript">\n<!--\n|.
qq| var editor=new FCKeditor("body");\n|.
qq| editor.BasePath = "$config{'ow_htmlurl'}/javascript/fckeditor/";\n|.
qq| editor.Height = "550";\n|.
qq| editor.ReplaceTextarea();\n|.
qq|//-->\n</script>\n|;
若想要讓chrome也可以使用html編輯器
找 sub htmlarea_compatible {
將以下程式替換
my $u=$ENV{'HTTP_USER_AGENT'};
if ( $u=~m!Mozilla/4.0! &&
$u=~m!compatible;!) {
return 0 if ($u=~m!Opera!); # not Opera
if ($u=~m!Windows! &&
$u=~m!MSIE ([\d\.]+)! ) {
return 1 if ($1>=5.5); # MSIE>=5.5 on windows platform
}
}
if ( $u=~m!Mozilla/5.0! &&
$u!~m!compatible;!) {
if ($u!~m!(?:Phoenix|Galeon|Firebird)/! &&
$u=~m!rv:([\d\.]+)! ) {
return 1 if ($1 ge "1.3"); # full Mozilla>=1.3 on all plaform
}
if ($u=~m!Firebird/([\d\.]+)!) {
return 1 if ($1 ge "0.6.1"); # Firebird>=0.6.1 on all plaform
}
}
return 0;
替換成
return 1;
中文會有 [UTF-8?] 字樣:
這是針對使用Big5編碼的人…
若是使用UTF-8..則是會出現[BIG5?]
這個可以參考 http://www.to2100.idv.tw/?p=5358
但目前我還不打算改這部份…
發現問題出在shares/iconv.pl
找到
sub _iconv {
裡面的一個回傳值
return "[".uc($from)."?]".$s;
他的註解說如果轉換失敗,就會把來源編碼貼在字串的開頭…
只是…一般我們所看到的大部分文字都顯示正常…卻被貼上這個mark…
還不太瞭解他為何會是轉換失敗…
目前先把這串改成
return $s;
這樣就不會在出現那個討厭的mark….
另一個方法則是捨去_iconv這個function
採用Encode的方式來做
一樣是在iconv.pl
在
use Text::Iconv;
下方加入
use Encode qw/encode decode/;
找到
$text[$i]=~s/(\S+)/_iconv($from, $to, $1)/egis;
用下方程式取代
$text[$i]=~s/(\S+)/encode($to, decode($from, $1))/egis;
這樣也可以達到相同效果,
而且也可以大致上將編碼轉換過來,
轉不過來的字會變成?
至少…不會都是奇怪的方框了…
20100304
今天發現有人信箱會開不起來…
顯示Encode error….
因為他的信裡面有怪編碼….導致無法Encode…
所以只好改回上面的 return $s; 這個方法了
想請問 , high light了的部份代表需要修改還是捨棄?
還有 , 由A圖替代成B圖 , 有很多CODE不見了 , 是否代表也需要捨棄~~~
謝謝 ^^
您好,
要注意看文內的敘述…
一般都是找到一段code…然後再修改成新的code…
我所列出的code….都是需要修正的地方…
沒有列出的code….不需要去動它哦
請問中文主旨會變成亂碼,如下:
openwebmail 中主旨
趕快拿起雿?瘞游ㄩ 看看是幾號塑材
/var/mail的內容
?BIG5?B?ILuwp9aus7A=?= _ =?BIG5?B?p0GquqT0s/0grN2s3axPtFi4?= =?BIG5?B?ubbsp/c=?=
不知版大有沒有經驗
您好,
看起來變亂碼的那幾個字,不是big5…
您可以試著切換編碼,看看字是寫什麼…
再寫新信件…將字全部輸入到主旨…寄給自己..
看看會不會變成亂碼….記得不要用複製貼上哦….
我看了一下,在讀信時,選用完全表頭,字集選utf-8 > big5 就正常
但是openwebmail-read.pl 的簡單表頭 和openwebmail-main.pl
這兩個都不會自動選用 utf-8 >big5
都用big 5來顯示來文的主旨
我是用2.53版
我試圖更改 openwebmail-read.pl 中的
($from,$replyto,$to,$cc,$bcc,$subject)
=iconv(‘utf-8′, $readcharset, $from,$replyto,$to,$cc,$bcc,$subject);
utf-8 更成 big5 結果是 from 和 subject 都變成亂碼
改回 utf-8 就剩 subject 是亂碥
現在是部份郵件會如此,我在想會不是是中文碼有吃碼的狀況
原本:藝文中心第七期油畫創作招生中
openwemail 信件列表和簡單表頭所看到的主旨
??銝剖?蝚砌??硃?奕虴@??銝?
/var/spool/mail 的檔案
=?big5?Q?=C3=C0=A4=E5=A4=A4=A4=DF=B2=C4=A4C?==?big5?Q?=B4=C1=AAo?==?big5?Q?=B5e?==?big5?Q?=B3=D0=A7?=@=?big5?Q?=A9=DB=A5=CD=A4=A4?=
看來比較有可能的原因是…
對方寄來的信件是utf8…在utf8轉換big5時~
部份的字無法轉換成功..導致影響其他字元的對應…
因為big5字碼本來就比utf8少…
所以還是會建議您整個系統都採用utf8會比較好….
我是用utf-8 架好了,
發現 addressbook 的按鈕
不能用,才又改回big5
現在為了這個問題,不能正式上線
我剛看了openwebmail-read.pl 看到
完全表單,他用
decode_mimewords_iconv($message{header}, $readcharset)
簡單表單是
$message{subject},
,前者就的subject 是OK的,
我現在往把字串抓出的方式來做
utf8的addressbook不能用?
是怎麼樣的不能用呢?
字集:
utf-8
address book 和 網路硬碟的按鈕可以點
到是不出小視窗
charset 改成 big5
就能點
看您的敘述…好像是javascript出問題
有時間我裝起來試試看…
因為之前裝的utf8都還蠻正常的…
前天我把openwebmail-read.pl 看了一下,
完整表頭是用header ,所以用字串處理的方式
把主旨由subject 用 header 替代過去,90%以上
的都沒問題了。現在問題來了openwebmail-main.pl
的程式內,讀取列表的方式,只有subject 沒有header
的變數可以用。還是得從郵件編碼的主旨下手。
用您說的方法,把相同主旨內容寄給自己,一
比對,幾封信錯誤的地方,都不盡相同。又是一個棘手問題
您好: 目前我在openwebmail-main.pl 的地方
比照openwebmail-read.pl 的寫法,把from 和subject
重新抓,解決了大部份亂碼的問題。
謝謝您的協助。
真是辛苦您了…
由於openwebmail維護的時間停滯很久…
所以大部分也都開始轉向其他的web mail…
你也可以試試看 RoundCube 這一套web mail