Needs review
Project:
Mail System
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
22 Apr 2013 at 15:26 UTC
Updated:
8 May 2020 at 07:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
m-p-j commentedHad the same issue with in posts that were sent via email.
Replacing "chr(160)" with "chr(194).chr(160)" html_to_text.inc seems to fix it.
Comment #2
phKU commentedI confirm the issue: non breaking spaces have to be inserted in utf-8 format. Otherwise the back conversion to space alters characters whose are composed with the chr(160) code, for e.g. the « à » character composed by utf-8 code chr(195) + chr(160). To fix it, in html_to_text.inc:
at line #128, replace:
$text = str_replace(chr(160), ' ', trim($text, $eol));with
$text = str_replace(chr(0xC2) . chr(0xA0), " ", trim($text, $eol));and at line #174, replace:
$text = str_replace(' ', chr(160), $text);with
$text = str_replace(' ', chr(0xC2) . chr(0xA0), $text);Comment #3
jcisio commentedI don't think the first convert is necessary, because there are people who really want nbsp instead of sp, even in plain text email.
Comment #4
jcisio commentedComment #5
das-peter commentedHad the same issue using mailsystem 7.x with maillog that stores the mails for debugging purposes.
Comment #6
tregismoreira commentedI had same issue using Mailsystem 7.x-2.x + HTMLMail. The best approach I could find is to use
mb_convert_encoding(chr(160), 'UTF-8', 'HTML-ENTITIES')instead ofchr(160). It worked for me.Here's my patch against to 7.x-2.x-dev.
Comment #7
monstrfolk commentedPatch works. Thanks.
Comment #8
monstrfolk commentedOne side effect...makes some lines break before they should.
Comment #9
monstrfolk commentedComment #10
monstrfolk commentedComment #11
nitheesh commentedInstead of replacing all the occurrences of char(160), just decode the formatted string and replace the non-breaking space character before appending it back to the result set.