Problem/Motivation
I'm using Simplenews + cck + Nodereference + Mimemail for sending newsletters in plain text (Mimemail because a custom module uses it to attach files to other mails).
Everything works fine except the transformation "html mail" -> "plain mail".
Given:
<h2>Band name</h2>
Result:
-------- Band name
-----------------------------------------------------------
As you can see there is a linebreak in the headline. I figured out that the core helper function _drupal_html_to_text_pad() adds one '-' too much. After changing line
$n = max(0, 79 - (strlen($text) - $p) - strlen($prefix));
to
$n = max(0, 78 - (strlen($text) - $p) - strlen($prefix));
everything works fine.
Are there other people out there with this problem? If not - do you have any ideas what's going wrong?
A little debug information:
$n = max(0, 79 - (strlen($text) - $p) - strlen($prefix));
dpm(strlen($text)); // 783
dpm($p); // 766
dpm(strlen($prefix)); // 1
dpm($n); // 61
PHP Version: 5.2.6-1+lenny9
Steps to reproduce
TBA
Proposed resolution
TBA
Remaining tasks
TBA
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#34 | Screenshot 2023-03-15 at 5.25.59 PM.png | 165.04 KB | Santosh_Verma |
#32 | 923510-32.patch | 6.67 KB | Rishabh Vishwakarma |
| |||
#5 | line_padding-923510-5.patch | 6.58 KB | Anonymous (not verified) |
#2 | line_padding-923510-1.patch | 534 bytes | Anonymous (not verified) |
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedRFC 2822:
_drupal_html_to_text_pad() pads lines to 79 characters. This causes unintended line breaks in many e-mail applications.
Haggins has provided the proper fix above.
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedComment #4
Anonymous (not verified) CreditAttribution: Anonymous commentedComment #5
Anonymous (not verified) CreditAttribution: Anonymous commentedModifying tests accordingly. First time I do this, but makes sense to me, somehow. Hope I can get it to work. Please excuse me spamming this issue.
Comment #6
Anonymous (not verified) CreditAttribution: Anonymous commentedComment #7
Anonymous (not verified) CreditAttribution: Anonymous commentedComment #8
Anonymous (not verified) CreditAttribution: Anonymous commentedI send thousands of Simplenew newsletters per month using this fix. It is simple and it works. No need to delay.
Should be backported to D6 and D7 ASAP. A chance to prove the Drupal community is interested in common standards.
Comment #9
webchickPlease don't mark your own patches RTBC.
Comment #10
Anonymous (not verified) CreditAttribution: Anonymous commentedPlease don't delay trivial fixes.
Comment #11
Anonymous (not verified) CreditAttribution: Anonymous commentedNewsletters of Drupal.org are affected. Received today:
"The shoemaker's son always goes barefoot."
Comment #12
haggins CreditAttribution: haggins commentedWhy is this a 8.x issue? D7 is affected as well.
Comment #13
NaheemSays CreditAttribution: NaheemSays commentedDevelopment is done on a trickle down basis where new development/bug fixes are developed for the latest version and then backported to supported versions.
So moving back to 8.x - when fixed there, it can then be backported to 7.x.
@ comment 10 - there is a process that is followed because even what sometimes seems trivial can cause problems and have repercussions, so unless it is a security issue (and even then), there needs to be a process followed, which some times may seem like overkill, but it is there for a reason and has developed out of past development experience.
Comment #14
NaheemSays CreditAttribution: NaheemSays commented#5: line_padding-923510-5.patch queued for re-testing.
Comment #25
jungle_drupal_html_to_text_pad()
does not exist anymore, and changing the target version to the current dev branch.Comment #31
quietone CreditAttribution: quietone at PreviousNext commentedI tested on Drupal 10.1.x, using the instructions in the issue summary and reproduced the problem.
Comment #32
Rishabh Vishwakarma CreditAttribution: Rishabh Vishwakarma at OpenSense Labs for DrupalFit commentedAdded patch for 10.1.x as the problem can be reproduced.
Comment #33
Rishabh Vishwakarma CreditAttribution: Rishabh Vishwakarma at OpenSense Labs for DrupalFit commentedComment #34
Santosh_Verma CreditAttribution: Santosh_Verma at Srijan | A Material+ Company for Drupal India Association commentedI have tested patch #32, applied successfully.
Comment #35
smustgrave CreditAttribution: smustgrave at Mobomo commentedStill needs an issue summary update for the TBD sections.