Hi all:
I encounter a strange problem when i uploaded file in sqwebmail. I'm run
ing Mandrake Linux 8.2 (Locale zh_CN.GB2312 ), when i upload a file withChinese GB or
Chinese Big5 encoding filename, the attachment list will show
me some ".......doc" or ".......zip" , ".......txt".
All multibyte chars of the attachment filename has been replace with ".".
Is it a problem cause by locale? but i ensure that en_US and ISO-8859-1 and
zh_CN.GB* locale have been all installed in my linux box..
Under console, i chdir to the Maildir/cur and view the raw mail message.
I found the attachment setcion became the following:
--cut begin--
Content-Disposition: attachment; filename*=gb2312'zh_CN'�Լ���.doc
Content-Type: application/msword; name*=iso-8859-1''%D7%D4%BC%F6%D0%C5.doc
Content-Transfer-Encoding: base64
--cut end----
the first line is right but the second line seems to be change to iso8859
encoding and transfer the filename to another kind of encoding(this encoding
is similar with some html url encoding, but i'm not sure).
Then i search source code of sqwebmail,and found something.In attachment.c
, attach_upload() will finally call ${prefix}/libexec/makemime to build a
mime section. Apparently sqwebmail will pass "-C" and"sqwebmail_content_charset"
to makemime, everything should go well, but it gone bad in my Linux box :(
in the rfc2045/makemime.c i found the following code, and i think this
code generate that strange string of ".......doc" or ".......zip":
if (m->contentname && *m->contentname)
{
const char *c;
fprintf(m->outputfp, "; name*=%s''",
m->textplaincharset ? m->textplaincharset
: "iso-8859-1");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Is this something wrong ? or m->textplaincharset = 0 then name*=iso-8859-1?
for (c=m->contentname; *c; c++)
{
if (*c <= ' ' || *c >= 127
|| strchr("'\";,\\=:", *c))
fprintf(m->outputfp, "%c%02X", '%',
(int)(unsigned char)*c);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I think this for loop statement is to transfer multibyte and something else
to that kind of encoding.....?
else
putc(*c, m->outputfp);
}
}
Sam, how to solve this problem ? I think it's not a bug but a mechanism
to advoid 8bit mime or string to encounter problem , but i could not view
correctly attchment filename ..:(
--
Hzqbbc
-----------------------------------------
Welcome to use http://webmail.hzqbbc.com
Commerical support - [EMAIL PROTECTED]
-----------------------------------------