I'm queuing all mails and so store them in the database. My problem is that a mail with some French text in it failed to save properly around a simple " à ". After digging a bit through the code and searching for a solution I found this (not related to drupal but basically the same issue):

I played around with chr(194).chr(160) and got it working, unfortunately I'm on holidays now so I won't be able to provide a patch. But I don't even know where I have to replace the non-breaking space, just everywhere?


#3 mailsystem-1976716-nbsp.patch1.28 KBjcisio


elpuzzo’s picture

Component:Module compatibility» Code

Had 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.

phKU’s picture

I 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));
$text = str_replace(chr(0xC2) . chr(0xA0), " ", trim($text, $eol));
and at line #174, replace:
$text = str_replace(' ', chr(160), $text);
$text = str_replace(' ', chr(0xC2) . chr(0xA0), $text);

jcisio’s picture

Issue summary:View changes
Status:Active» Needs review
new1.28 KB

I don't think the first convert is necessary, because there are people who really want nbsp instead of sp, even in plain text email.

jcisio’s picture

Version:6.x-2.34» 6.x-2.x-dev