I have just installed the attachment_doc plugin (version 1.2) in squirrelmail. But it has a bug, that the converted document is in utf-8, while the character encoding sent by squirrelmail, in the http header, "Content-Type: text/html; charset=...", will depend on the user language preference setting. So, the browser will incorrectly render the utf-8 charset in the converted document, if the character set in the user language preference is not utf-8.
My interim solution to this problem is to put the following lines, in plugins/attachment_doc/includes/config.php,
$languages[$sm_notAlias]['CHARSET'] = "utf-8"; header( 'Content-Type: text/html; charset=' . $languages[$sm_notAlias]['CHARSET'] );
It work fine, now.
But this solution may not a good design, since it is a hook into some squirrelmail variables. To not hook these variables, attach_doc should do convert "utf-8" or unicode character into the form like "&#XXXX;", which is the unicode encoding in html entity. attach_doc can use the function charset_decode_utf8(), provided by squirrelmail, to convert these utf-8 characters, like this,
include_once(SM_PATH . 'functions/decode/utf-8.php'); set_my_charset(); $str = charset_decode_utf8 ($str);
--Ans 08:36, 25 October 2007 (UTC)
Ensuring UTF-8 from wv output Edit
According to wvWare(1) man page, it doesn't ensure that it will convert document into utf-8 by default. So, to ensure utf-8 first, one must config plugins/attachment_doc/includes/config.php like this,
$wvWarecmd = "$bindir/wvHtml --charset=utf-8 --targetdir=$dirname $dirname/$docname $htmlname";
--Ans 08:49, 25 October 2007 (UTC)
- Bug entry on sourceforge
- Attachment document plugin
- Special thanks to http://www.easyprojects.net/project-portfolio-management-software/ for assistance.