Commit 88889e2f authored by Sam Varshavchik's avatar Sam Varshavchik

cone: additional UTF-8 fixes

Use UTF8 APPEND, when using a UTF8-ENABLEd IMAP server.

Parse E-mail addresses as UTF-8, by default.

When SEARCHing messages, assume a MIME message body without a content-type
charset uses UTF-8.
parent 50e86987
......@@ -1554,13 +1554,24 @@ void mail::imapAPPEND::go()
return;
}
bool utf8_enabled=imapAccount.utf8_enabled();
try {
string flags=imapAccount.messageFlagStr(messageInfo);
fprintf(tmpfileptr, "\r\n");
size_t extra_stuff=0;
// Part of the UTF8 APPEND cmd, actually:
if (utf8_enabled)
{
fprintf(tmpfileptr, ")");
++extra_stuff;
}
// Part of the APPEND cmd, actually
// Part of the APPEND cmd, actually:
fprintf(tmpfileptr, "\r\n");
extra_stuff+=2;
bytesDone=0;
......@@ -1580,7 +1591,7 @@ void mail::imapAPPEND::go()
{
ostringstream o;
o << bytes-2;
o << bytes-extra_stuff;
cnt_s=o.str();
}
......@@ -1608,7 +1619,8 @@ void mail::imapAPPEND::go()
appendcmd="APPEND " + imapAccount.quoteSimple(path)
+ " (" + flags + ") "
+ imapAccount.quoteSimple(p)
+ " {" + cnt_s + "}\r\n";
+ (utf8_enabled ? " UTF8 (~{" : " {")
+ cnt_s + "}\r\n";
imapAccount.installForegroundTask(this);
} catch (...) {
......
......@@ -399,10 +399,7 @@ void mail::emailAddress::decode()
ucaddr.reserve(addr.size());
std::string::iterator b, e;
for (std::string::iterator b=addr.begin(), e=addr.end(); b != e; ++b)
ucaddr.push_back((unsigned char)*b);
unicode::iconvert::convert(addr, "utf-8", ucaddr);
#if LIBIDN
size_t at=std::find(ucaddr.begin(), ucaddr.end(), '@')
......
......@@ -550,7 +550,7 @@ void mail::searchOneMessage::checkNextHeader()
return;
mail::mimestruct *hdrs;
std::string bodyCharset("iso-8859-1");
std::string bodyCharset("utf-8");
for (;;) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment