A place for users and developers of the Xataface to discuss and receive support.
by jvinolas » Thu Oct 06, 2011 4:56 am
Hi,
I'm sending emails correctly with the email module. The problem is with character set, so when I send special chars like "óñ..." they are shown as garbage.
Do I have to modify anything in Email module so it processes the chars correctly?
Thanks.
-
jvinolas
-
- Posts: 51
- Joined: Thu Apr 15, 2010 12:31 am
by shannah » Thu Oct 06, 2011 10:08 am
Are you copying and pasting into the email from another program, or are you entering directly into the email field?
-
shannah
-
- Posts: 4457
- Joined: Wed Dec 31, 1969 5:00 pm
by jvinolas » Wed Oct 19, 2011 4:11 am
Hi I'm writing it directly from keyboard. This is an extract from the contents of the email, I think maybe could it be caused by debian locate? I can't see in this email header the charset 'us-ascii'. - Code: Select all
X-Mailer: XPM4 v.0.5 < www.xpertmailer.com > Content-Type: multipart/alternative; boundary="=_" MIME-Version: 1.0
This is a message in MIME Format. If you see this, your mail reader does not support this format.
--=_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
Prova de mail VI=C3=91OLAS AUQUER=09=09=09
Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
Prova de mail VI=C3=91OLAS AUQUER=09=09=09<hr />
--=_
-
jvinolas
-
- Posts: 51
- Joined: Thu Apr 15, 2010 12:31 am
by jvinolas » Mon Nov 28, 2011 8:54 am
I solved it adding the charset and encoding to email.php (in dataface/modules/Email/actions). I modified this two lines (adding the code: ,'iso-8859-1','8bit'): - Code: Select all
// set text/plain version of message $text = MIME::message(htmlspecialchars_decode(strip_tags(preg_replace(array('/<br[^>]*>/i','/<div[^>]*>/i','/<p[^>]*>/i', '/<table[^>]*>/i'), array("\r\n","\r\n","\r\n","\r\n"),$content))), 'text/plain','iso-8859-1','8bit'); // set text/html version of message $html = MIME::message($html_content, 'text/html','iso-8859-1','8bit');
-
jvinolas
-
- Posts: 51
- Joined: Thu Apr 15, 2010 12:31 am
by shannah » Mon Nov 28, 2011 10:59 am
Thanks a lot. I have made a small variation on this fix and committed it to SVN: - Code: Select all
Index: email.php =================================================================== --- email.php (revision 3072) +++ email.php (revision 3073) @@ -313,9 +313,9 @@ $id = MIME::unique(); // set text/plain version of message - $text = MIME::message(htmlspecialchars_decode(strip_tags(preg_replace(array('/<br[^>]*>/i','/<div[^>]*>/i','/<p[^>]*>/i', '/<table[^>]*>/i'), array("\r\n","\r\n","\r\n","\r\n"),$content))), 'text/plain', null, MIME::HCHARSET); + $text = MIME::message(htmlspecialchars_decode(strip_tags(preg_replace(array('/<br[^>]*>/i','/<div[^>]*>/i','/<p[^>]*>/i', '/<table[^>]*>/i'), array("\r\n","\r\n","\r\n","\r\n"),$content))), 'text/plain', $app->_conf['oe'], MIME::HCHARSET); // set text/html version of message - $html = MIME::message($html_content, 'text/html', null, MIME::HCHARSET); + $html = MIME::message($html_content, 'text/html', $app->_conf['oe'], MIME::HCHARSET); // add attachment with name 'file.txt' //$at[] = MIME::message('source file', 'text/plain', 'file.txt', 'ISO-8859-1', 'base64', 'attachment'); //$file = 'xpertmailer.gif';
In this case I'm using the encoding of the application (iso-8859-1 if monolingual english, utf-8 otherwise) rather than hardcoding it. -Steve
-
shannah
-
- Posts: 4457
- Joined: Wed Dec 31, 1969 5:00 pm
Return to Xataface Users
Who is online
Users browsing this forum: No registered users and 10 guests
|