Closed Bug 169395 Opened 22 years ago Closed 9 years ago

Long words (~990 characters) are wrapped (quoted-printable)

Categories

(MailNews Core :: Composition, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 31.0

People

(Reporter: 3.14, Unassigned)

Details

(Whiteboard: [will be superceded by jsmime being hooked up to compose])

Attachments

(1 file, 3 obsolete files)

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2a) Gecko/2002091318
Mozilla/5.0 (Windows; U; Windows NT 5.0; de-AT; rv:1.1) Gecko/20020826
and other version (users of de.comm.software.mozilla contributed to this bug)

This is happening for plain text, I don't now what happens for HTML composition.

I posted a very long URL, actually a bugzilla query
(news:am6pne$359rl$1@ID-3289.news.dfncis.de). This URL was wrapped after 991
characters (users using format flawed have one character less). I allow
quoted-printable, with is crucial due to the line length limitation of some news
servers (and mail servers?). In my case quoted-printable was *not* used, hence
the URL had to be wrapped. This is one part of the bug.

In another posting which was quoted-printable, the URL was also wrapped, here
without any justification. This is part two of the bug.

pi
does this get wrapped while composing the mail, or after clicking send? in the
latter case, it would belong to MailNews somehwere, probably Networking:NNTP

and even in the first case, it's probably MailNews:Mail Compose (if that exists)
I did a quick and dirty test. I pasted the URL into a MailNews window and saved
it. In the drafts folder it was already wrapped.

pi
changing component
Assignee: kin → ducarroz
Component: Editor: Core → Composition
Product: Browser → MailNews
QA Contact: sujay → esther
As to part one of the bug: There were no 8-bit characters in the posting so
Mozilla used 7-bit US-ASCII. Suggestion: If QP is enabled, it should be used
when (a) 8-bit characters appear (as it's already done) and (b) when lines
exceeding 990 characters exist. (BTW it's 991 characters including one space for
f=f.) With a default of 8-bit, the current implementation should remain
unchanged, i.e. (a) only.
As to part two, this can probably only be fixed by removing the "XXL line wrap"
in message composition and moving it to a stage shortly before mail/news gets
sent. Then only non-QP messages should still have such very long lines.
I have found a similar problem with quoting. I think it reffers to this bug, so
I will post it here.

If you quote a long string *or* a long text, in both cases the text is wrapped
before it should be wrapped.

If you quote aaaaaa (~990 chars) the first ~988 chars will be quoted, and the
other chars will not be quoted.

For example:

> aaaaa (long line)
aa (rest of the string above)

But this problem does not only occur when wrapping a string, it occurs also when
you want to wrap a long text without manual linebreaks. The first 990 chars of
the text will be quotet, then it will be wrapped, and the rest of the text will
be put a one line down, but will not be quoted.

For example: (I try to quote a long text (more than 990 chars), sybolized by the
text "I like snow in winter because it is very cold then")

> I like snow in winter
> because it is very cold
then
Product: MailNews → Core
Apply in the root of the cvs working copy with patch -p0.

Note that this has only been tested with Thunderbird 1.5.0.2 on Linux. This is also my first time hacking the Mozilla sources. Expect it to break something! Hopefully it will be useful as a starting point at least.
Attachment #221653 - Flags: review?(ducarroz)
The desired behaviour described is implemented for text file attachments but not for the message body. The problem stems from mailnews/compose/src/nsMsgSend.cpp (class nsMsgComposeAndSend) handling the first message part (the main body) differently from the other parts. As several comments in the file say, the code should ideally be re-written to allow the message body to be treated largely the same as an attachment to avoid code duplication.

However I have been able to make a fix by:
- removing the nsMsgComposeAndSend::EnsureLineBreaks private member function
- updating nsMsgComposeAndSend::SnarfAndCopyBody to not call EnsureLineBreaks and instead accept the body text as it is without worrying about line lengths
- updating nsMsgComposeAndSend::GatherMimeAttachments to check for long lines in the body and use quoted-printable if any are found (this works in a very similar way to nsMsgAttachmentHandler::PickEncoding for attachments)

Scanning the body for long lines shouldn't be any more costly (in terms of speed or memory) than the hard breaking of lines by EnsureLineBreaks. It might even be better.

See the attached patch.
Mad Alex, are you still around?  Is this patch still viable?

Obviously, Ducarroz is not doing anything for us any more.  If you can get this patch working, this would be great to get into the system.  Try asking for a review from:  bienvenu@nventure.com

xref bug 277185, bug 344654
Assignee: ducarroz → nobody
QA Contact: esther → composition
Comment on attachment 221653 [details] [diff] [review]
Patch to remove the 990 line length limit and use quoted-printable with long lines

That patch still applies OK, albeit with some slight offsets where things have changed. I have only given it a quick test but it compiled fine and everything seemed to work correctly.
Attachment #221653 - Flags: review?(ducarroz) → review?(bienvenu)
Whiteboard: [has patch]
Updated the patch to make it work again with recent changes in CVS.

It would be really nice to see this make it into CVS as it brings mozilla's handling of long lines closer to that of other mail software and fixes various bugs in addition to this one; in particular the hacks (with their associated bugs) to walk backwards and insert breaks in sensible places (e.g. in HTML) become obsolete and are removed by this patch.
Attachment #221653 - Attachment is obsolete: true
Attachment #267075 - Flags: review?
Attachment #221653 - Flags: review?(bienvenu)
Attachment #267075 - Flags: review? → review?(kaie)
Product: Core → MailNews Core
Whiteboard: [has patch] → [has patch][patchlove]
Updated the patch for recent changes in CVS
Attachment #267075 - Attachment is obsolete: true
Attachment #267075 - Flags: review?(kaie+oldbugzilla)
Alex, the latest sources are now in Mercurial, could you please patch against comm-central sources?

Ref: https://developer.mozilla.org/en/Comm-central_source_code_(Mercurial)
Updated patch against the latest comm-central sources. Thanks for the heads-up.
Attachment #372034 - Attachment is obsolete: true
(In reply to comment #13)
> Created an attachment (id=372051) [details]
> Patch to remove the 990 line length limit and use quoted-printable with long
> lines
> 
> Updated patch against the latest comm-central sources. Thanks for the heads-up.

You're welcome! :) Almost there, though.

Please also choose a reviewer from http://www.mozilla.org/mailnews/review.html and set the patch to request r? from the reviewer accordingly.
Attachment #372051 - Flags: review?(bienvenu)
Assignee: nobody → madalexonline
Whiteboard: [has patch][patchlove] → [has patch]
bienvenu, do you still want this review?

Mad Alex, thanks for the updated patch.
(In reply to Wayne Mery (:wsmwk) from comment #15)
> bienvenu, do you still want this review?
Flags: needinfo?(mozilla)
Joshua, any effects for this issue or patch with forthcoming jsmime?
Flags: needinfo?(Pidgeot18)
(In reply to Wayne Mery (:wsmwk) from comment #17)
> Joshua, any effects for this issue or patch with forthcoming jsmime?

When I rewrite the MIME composition in jsmime, this patch will become obsolete.
Flags: needinfo?(Pidgeot18)
Comment on attachment 372051 [details] [diff] [review]
Patch to remove the 990 line length limit and use quoted-printable with long lines

(In reply to Joshua Cranmer [:jcranmer] from comment #18)
> (In reply to Wayne Mery (:wsmwk) from comment #17)
> > Joshua, any effects for this issue or patch with forthcoming jsmime?
> 
> When I rewrite the MIME composition in jsmime, this patch will become
> obsolete.

In that case, let's kill the review request. Besides, patch is 5 years old
Attachment #372051 - Flags: review?(mozilla)
Flags: needinfo?(mozilla)
Assignee: alex.mozilla → nobody
Whiteboard: [has patch] → [will be superceded by jsmime being hooked up to compose]
Looks like this was fixed by JSMime in bug 959309. Let's close this bug.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 31.0
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: