Author Topic: line wrapping  (Read 10380 times)

Offline roberrt

  • Newbie
  • *
  • Posts: 3
line wrapping
« on: December 09, 2008, 06:17:19 AM »
I noticed that when sending plain text messages with Roundcube, lines are wrapped to a maximum of 75 characters.
Sometimes this can be a little inconvenient, because other mail clients wrap lines at a different length when replying, causing single lines of the mail I initialy sent to be split up in two or more parts.

When looking at program/steps/mail/sendmail.inc I see that the function wordwap is used twice, once with maximum length 75 and once with maximum length 998.
According to rfc0821 the maximum total length of a text line including the is 1000 characters, so a maximum length of 998 makes perfect sense, but what about the 75, can it savely be removed?
« Last Edit: December 09, 2008, 06:18:28 AM by roberrt »

Offline solomin

  • Newbie
  • *
  • Posts: 6
line wrapping
« Reply #1 on: April 01, 2009, 02:00:30 AM »
Quote from: roberrt;15633
I noticed that when sending plain text messages with Roundcube, lines are wrapped to a maximum of 75 characters.
Sometimes this can be a little inconvenient, because other mail clients wrap lines at a different length when replying, causing single lines of the mail I initialy sent to be split up in two or more parts.

When looking at program/steps/mail/sendmail.inc I see that the function wordwap is used twice, once with maximum length 75 and once with maximum length 998.
According to rfc0821 the maximum total length of a text line including the is 1000 characters, so a maximum length of 998 makes perfect sense, but what about the 75, can it savely be removed?


UP
Is 75 symbols wrapping really needed for something?

Offline Julius Caesar

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 498
    • http://www.de-keizer.net/
line wrapping
« Reply #2 on: April 01, 2009, 03:00:28 AM »
Quote from: solomin;18161
UP
Is 75 symbols wrapping really needed for something?

The default line wrapping  at 75 characters is from the time, only text-based terminals were used (You know, the 80x25 ones with a glaring text green color).

Nowadays, when using a text-based connection with ssh or telnet (the last one is not secure) in combination with a text-based mail-client like mutt or pine, these settings still apply.

So when sending plain-text messages, the line-wrap is about 75 characters.
« Last Edit: April 01, 2009, 03:02:48 AM by Julius Caesar »
Julius Caesar

You can download the Groupvice4 theme here.
Sie können Groupvice4 hier he

Offline solomin

  • Newbie
  • *
  • Posts: 6
line wrapping
« Reply #3 on: April 01, 2009, 03:47:27 AM »
Quote from: Julius Caesar;18162
The default line wrapping  at 75 characters is from the time, only text-based terminals were used (You know, the 80x25 ones with a glaring text green color).

Nowadays, when using a text-based connection with ssh or telnet (the last one is not secure) in combination with a text-based mail-client like mutt or pine, these settings still apply.

So when sending plain-text messages, the line-wrap is about 75 characters.

If i don`t have text terminals, i can change these to 998?
These is problem, because composing message in HTML has bug:
#1485607 (Broken encoding in atached html and htm files) ? RoundCube Webmail
For example, if i send message in HTML with Cyrillic symbols to Outlook express,i receive unreadable text in reply from receiver.
« Last Edit: April 01, 2009, 03:49:46 AM by solomin »

Offline Julius Caesar

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 498
    • http://www.de-keizer.net/
line wrapping
« Reply #4 on: April 01, 2009, 04:13:57 AM »
Quote from: solomin;18163
If i don`t have text terminals, i can change these to 998?
These is problem, because composing message in HTML has bug:
#1485607 (Broken encoding in atached html and htm files) ? RoundCube Webmail
For example, if i send message in HTML with Cyrillic symbols to Outlook express,i receive unreadable text in reply from receiver.


It's not only for you, but also for the receiver. The receiver must be able to read it in a text-based environment. You'd better revive this ticket instead of ignoring standards.
Julius Caesar

You can download the Groupvice4 theme here.
Sie können Groupvice4 hier he

Offline Master One

  • Jr. Member
  • **
  • Posts: 15
line wrapping
« Reply #5 on: March 23, 2010, 10:58:58 AM »
I am also experiencing problems with line wrapping at 75 characters (in text-mode, which I usually prefer to HTML emails). The problem here is the quoted text when replying, which then can look like this:
Quote
> this is a sentence, which gets line wrapped at 75 characters
and
> the output of quoted text gets disturbed by the wrapping

Is there any solution for this problem?

Offline ABerglund

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 673
line wrapping
« Reply #6 on: March 23, 2010, 11:21:01 AM »
Quote from: Master One;26277
I am also experiencing problems with line wrapping at 75 characters (in text-mode, which I usually prefer to HTML emails). The problem here is the quoted text when replying, which then can look like this:
Is there any solution for this problem?
Not really. That can happen in any plain text email reply. Not specifically a RC issue at all. I see it in squirrelmail, Thunderbird, etc.
Arne Berglund
SysAdmin, Internet Services
Lane Education Service District
Eugene, OR, USA

Offline Master One

  • Jr. Member
  • **
  • Posts: 15
line wrapping
« Reply #7 on: March 23, 2010, 11:45:31 AM »
That's bad, I am working with a lot of quoted text every day, and when such a quoted line gets wrapped without the ">" at the beginning, the whole text-block gets completely messed up.

No idea, what to do... :(

Offline Julius Caesar

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 498
    • http://www.de-keizer.net/
line wrapping
« Reply #8 on: March 23, 2010, 11:49:57 AM »
Quote from: Master One;26279
That's bad, I am working with a lot of quoted text every day, and when such a quoted line gets wrapped without the ">" at the beginning, the whole text-block gets completely messed up.

No idea, what to do... :(


The only thing you can do is edit the quoted text (reformat the text, not editing the content), so it fits again within the 75-character line width.
Julius Caesar

You can download the Groupvice4 theme here.
Sie können Groupvice4 hier he

Offline Master One

  • Jr. Member
  • **
  • Posts: 15
line wrapping
« Reply #9 on: March 26, 2010, 11:12:08 AM »
There is still something wrong with line-wrapping.

I just replied to an email in text-editor-mode. The quoted lines were already wrapped accordingly, like the following:
Quote
> accept deliveries between normal working hours, which are 9-5pm? Also, do

This line is 75 characters long (including the "> " quotation mark).

So in the editor, everything looked OK. After I have sent that email, I looked at that message in the Sent-folder, and had to discover, that it had been wrapped another time, which made it look like this:
Quote
> accept deliveries between normal working hours, which are 9-5pm? Also,
do

So if the line was 75 first, why has it been wrapped again to 72 characters?

Offline Master One

  • Jr. Member
  • **
  • Posts: 15
line wrapping
« Reply #10 on: April 07, 2010, 02:29:57 AM »
No idea?

It could be a bug after all, and it really is annoying, if the quoted text first looks fine in the editor, and is messed up, once it's sent.

Or am I the only one left, who is generally preferring pure text over html emails?

Offline Master One

  • Jr. Member
  • **
  • Posts: 15
line wrapping
« Reply #11 on: April 08, 2010, 05:53:37 AM »
So I am quite confident now, that there is something wrong with the line wrapping.

I grep-ed through all files (grep -r wrap *), and found the two functions doing the wrapping:
Code: [Select]
program/include/rcube_shared.inc:
function rc_wordwrap($string, $width=75, $break="\n", $cut=false)

program/steps/mail/func.inc:
function rcmail_wrap_quoted($text, $max = 76)

Once again, the problem is, that at first in the editor when replying everything looks OK, but once sent, quoted text gets line wrapped a second time, and some lines always get messed up.

If normal wrapping is done at a line length of 75 characters, shouldn't it be 77 for quoted text, since the quotation inserts two additional characters (">" + space)?

I would so much appreciate, if someone could post a fix for that problem.

Offline Master One

  • Jr. Member
  • **
  • Posts: 15
line wrapping
« Reply #12 on: April 08, 2010, 09:10:35 AM »
Well, I think I found the solution:
Code: [Select]
--- program/steps/mail/compose.inc.orig 2010-04-08 14:41:15.000000000 +0200
+++ program/steps/mail/compose.inc 2010-04-08 14:41:49.000000000 +0200
@@ -522,7 +522,7 @@
       }
 
     // soft-wrap message first
-    $body = rcmail_wrap_quoted($body, 75);
+    $body = rcmail_wrap_quoted($body, 73);
 
     $body = rtrim($body, "\r\n");
 

The real problem is, that the function rcmail_wrap_quoted in program/steps/mail/func.inc first removes the "> ", does the wordwrap, and then rebuilds the lines with the "> ", resulting in a max. line-length of 77 (= line wrapped to 75 characters + "> "), which is then line-wrapped again at 75 characters in program/steps/mail/sendmail.inc, causing the mentioned problem with messed up quoted text, once it's sent.

So calling the function rcmail_wrap_quoted with a desired line-length value of just 73 should lead to the intended correct behaviour.

Someone with the right knowledge of the insides of Roundcube please have a look, and confirm that this is the proper way of handling this issue.

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,845
line wrapping
« Reply #13 on: April 09, 2010, 03:25:15 AM »
what version of RC are you using? if its not SVN trunk then if you can I suggest you give that a try, there have been a few changes to the wrapping and may be this has been sorted already. If you think its still not right in the trunk then the best thing to do is head on over to trac.roundcube.net and open a ticket.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…

Offline Master One

  • Jr. Member
  • **
  • Posts: 15
line wrapping
« Reply #14 on: April 09, 2010, 03:43:27 AM »
I am using 0.3.1, but just took a look at trunk, and although a configurable $LINE_LENGTH has been introduced, it seems the problem for text-emails has not been fixed (there is only one part in compose.inc, which reduces $LINE_LENGTH by 2 for html part).

I'll open a ticket then.

EDIT: Ticket # 1486622 opened.
« Last Edit: April 09, 2010, 05:13:16 AM by Master One »