Closed Bug 132671 Opened 24 years ago Closed 23 years ago

Double-byte mails in Sent/Trash/Draft/Unsent folder are not imported correctly (outlook)

Categories

(MailNews Core :: Internationalization, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: ji, Assigned: cavin)

References

Details

(Keywords: intl, Whiteboard: [adt2][ish1+][verifiedish1])

Attachments

(5 files, 1 obsolete file)

Build: 03/20 win32 build Now bug 100867 is fixed, double-byte mails in Inbox/Trash/Draft/Unsent can be imported correctly. But the mails in Sent folder are displayed garbled after import. Steps to reproduce: 1. With Outlook XP Simplified Chinese version, have Chinese mails stored in Inbox/Trash/Draft/Unsent/Sent folders in POP3 account. 2. Launch Mail with the trunk build. 3. Select File | Import to import the mails from Outlook XP, you can see after import, Chinese mails in Inbox/Trash/Draft/Unsent shows alright. But the mails including both subject and mail body in Sent folder are displayed garbled. Screenshot to follow.
Keywords: intl
Reassign to putterman.
Assignee: nhotta → putterman
reassigning to Cavin
Assignee: putterman → cavin
Nominating for nsbeta1 since it causes data corruption.
Keywords: nsbeta1
Keywords: nsbeta1nsbeta1+
Whiteboard: [adt2 rtm]
> mail body in Sent folder is displayed garbled > I thnk this can be resolved by selecting the Auto-Detect|Japanese via View|Character Coding... menu item. Reporter, can you verify this? > subject in Sent folder is displayed garbled > I do see that the encoding of the subject is not correct for some reason. Looking into the problem.
In above mail, both sender and mail body don't have charset info. For mail body, auto-detector can be used for display. We also need to fix sender problem as well. Now applying folder charset can't make sender displayed correctly.
Yes, both sender and subject have the same problem.
Discussed at mail news bug meeting. Decided to remove RTM from this bug. This means fixing this bug is currently not planned for RTM.
Whiteboard: [adt2 rtm] → [adt2]
Keywords: nsbeta1+nsbeta1-
Blocks: 157010
Blocks: 157673
Summary: Double-byte mails in Sent folder are not imported correctly → Double-byte mails in Sent folder are not imported correctly (outlook)
nominate for nsbeta1
Keywords: nsbeta1-nsbeta1
Using US version of Outlook Express and English version of Netscape 7 under Win 2000 US/JPN locale, I could not confirm this problem. However, my test cases have all the OE folder names in English. We need to re-test this with the following typical environments for Japanese also: 1. JPN Win 2000 with JPN version of Outlook Express & JPN Netscape 7. 2. JPN Win XP with JPN version of Outlook Express & JPN Netscape 7. ** Note in both cases, the Outlook folder names should be in Japanese.
This problem only exists when importing mail from Outlook, it doesn't happen when importing from Outlook Express. Checked on Japanese XP, after import from Outlook XP, Ja mails in Sent/Trash/Draft/Unsent are corrupted.
Summary: Double-byte mails in Sent folder are not imported correctly (outlook) → Double-byte mails in Sent/Trash/Draft/Unsent folder are not imported correctly (outlook)
As of July, 2002, we have the following stats from the Internet Association of Japan annual survey results: Percentage of Japanese users for top 3 Mail programs in descending order: Outlook Express: 75.5% Outlook: 10.3% Post Pet (by Sony): 7.7% So this problem does affect a significant user base (10.3%) of mail in Japan.
Checked this on Japanese ME with Outlook XP installed. Only mails in Sent folder got corrupted (attachment problem is reported seperately in bug 174402.) Open the message source for the imported mail, the subject is encoded in Shift JIS, and the sender is not MIME encoded at all. The original charset for the subject and sender is iso-2022-jp.
yes, that's what I saw on Japanese XP too. (Comment #11) It looks like the behaviour is different on different windows platforms.
Naoki and I were able to reproduce the problem and the content type of test msg in the Sent folder is multipart/alternative. The reason why Outlook does not work is that we use MAPI to retrieve the header and body info and MAPI returns the following content-type header: Content-Type: multipart/alternative; boundary="----=_NextPart_000_0009_01C273A8.66981CA0" which indicates that the body contains multiple body parts. However, the body data returned from MAPI contains only the original Japanese chars we entered in the compose window. In other words the body does not contain multiple body parts with different content types (as it should). For this reason we end up with a msg without the “Content-Type:” header and thus without the charset info. The reason why it works for OE is that it doesn’t use MAPI to retrieve header and body info, instead it interprets the msg stored in the OE msg store to get the data it needs. In this case the retrieved body data does contain two body parts (as expected) which contain content type info with correct charset. I need to try more test msgs (ie, some with attachments) to see if I can figure out a way to fix it but this is what I've found so far.
Whiteboard: [adt2] → [adt2][ish1+]
Another case that has the same problem is when a message does not have content type header at all. So to fix the two cases we've found so far we need to default content type to "text/html" or "text/plain" depends on the type of body data returned by MAPI.
Attached patch Proposed patch, v1 (obsolete) — Splinter Review
Set default content type for msgs without a content type header or with a "multipar/alternative" content type but the body data contains only text.
Comment on attachment 103787 [details] [diff] [review] Proposed patch, v1 r=nhotta
Attachment #103787 - Flags: review+
looks good, one comment: 1) + nsCAutoString body(msg.GetBody()); + if (body.Find(msg.GetMimeBoundary()) <=0) + needDefaultCType = PR_TRUE; This will copy the body unnecessarily. you should do something like: const char *body = msg.GetBody(); if (!body || !strstr(body,msg.GetMimeBoundary()) needDefaultCType = PR_TRUE; You probably check if msg.GetMimeBoundary() is null (or non-empty), too.
Good suggestion. So I changed: + if (msg.GetBodyLen() && msg.GetMimeBoundaryLen()) + { + // Comments here. + nsCAutoString body(msg.GetBody()); + if (body.Find(msg.GetMimeBoundary()) <=0) + needDefaultCType = PR_TRUE; + } to: + // Comments here. + const char *body = msg.GetBody(); + const char *boundary = msg.GetMimeBoundary(); + if (body && boundary && !strstr(body, boundary)) + needDefaultCType = PR_TRUE;
Incorporated comment (using a better way to check boundary in the body data).
Attachment #103787 - Attachment is obsolete: true
looks good. I think we can simplify the implementation of SetDefaultContentType. Consider: +{ + cType.Truncate() + + // double check that the comment is correct + if (msg.GetMimeContentLen()) { + if (nsCRT::strcasecmp(msg.GetMimeContent(), "multipart/alternative")) + return; + + // double check that the comment is correct + const char *body = msg.GetBody(); + const char *boundary = msg.GetMimeBoundary(); + // is this right? + // notice we return on !body or ! boundry + // or if we find it boundry in the body. + if (!body || !boundary || strstr(body, boundary)) + return; + } + + cType = msg.BodyIsHtml() ? "text/html" : "text/plain"; +} If that will work, can you switch to that, and make sure the comments are correct? once you do that, sr=sspitzer
Status: NEW → ASSIGNED
Yes the code can be simplied. nhotta actually memtioned this to me. The reason I used 'needDefaultCType' to qualify all cases is that if we have to add another case ot two later it'll be easier. Right now we only know two cases but more may need to be added. This code is used to workaround some MAPI issues.
Adding [fixedish1] to status whiteboard.
Whiteboard: [adt2][ish1+] → [adt2][ish1+][fixedish1]
On the build containing the fix, the problem described in the original report is fixed. BTW, after mail import is finished, there are two subfolders generated under Outlook Mail folder: Personal Folders and Saved Folders. Personal Folders contains all the regular folders, like Inbox, Sent, Trash....and etc. But Saved Folders contains Trash folder. What's "Saved Folders" for? (this also exists before the fix, it's not related to the fix.)
I'm not sure what "Saved Folders" is but some external users had told me about it. I don't see that on my machine and I don't think it's on nhotta's machine either.
I''m using Japanese Outlook XP. Could it be related to the language/version of the outlook ?
Whiteboard: [adt2][ish1+][fixedish1] → [adt2][ish1+][verifiedish1]
Fix checked in to the trunk.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Depends on: 180372
No longer blocks: 157673
verified as fixed using 2003042105-trunk build.
Status: RESOLVED → VERIFIED
Product: MailNews → Core
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: