+ Reply to Thread
Results 1 to 4 of 4

Thread: HowTo set FormMail to send utf-8 messages

  1. #1
    Join Date
    Dec 2007
    Posts
    4

    Default HowTo set FormMail to send utf-8 messages

    Hi,
    I am a new user of this nice program - however have some difficulties with charsets/utf-8 mime headers. I've read a lot of posts here explaining howto but none seem to work for me (yet)

    Here is what I am trying to do:
    1. Get input from the webform (with possibly non ASCII chars - e.g. russian language.)
    2a. Preferably to email the results in a plaintext format encoded with charset=utf-8 ... or alternatively
    2b. email via html template.

    It seems that there is no settings or posts explaining howto setup plaintext message header to use utf-8 - so no luck getting correct results displayed in plaintext... (always scrambled such as e.g.: & #1048;& #1084;& #1103; К& #1083;& #1080;& #1077;& #1085;& #1090;& #1072; - I did intentionally put space between & and # to prevent conversion in this forum dispaly only)

    Q1. Is it possible to setup formail with plaintext to use utf-8 encoding ?

    Many posts suggested to try the template approach (e.g. good post here:
    Sending form results in an HTML email)

    I did everything as described however the result email I am getting is rather strange - looks like this (tags from html template are encoded correctly they are "Сообшение через форму вебсайта"=message from your web formmail,
    "Имя Клиента"=realname, and last "Сообшение"=message) but the content which was obviously entered in utf-8 not encoded/displayed properly ...:

    & #1048;& #1084;& #1103; К& #1083;& #1080;& #1077;& #1085;& #1090;& #1072; to temp
    Сообшение через форму вебсайта:
    Имя Клиента:& #1048;& #1084;& #1103; К& #1083;& #1080;& #1077;& #1085;& #1090;& #1072;
    Email address: & #1048;& #1084;& #1103;@sdf.cvb
    Сообшение: & #1048;& #1084;& #1103;

    -again intentionally separating & and # for display here in forum - it is displayed exactly as above not converting "& #1048;& #1084;& #1103;" to "Имя" in IE/FF browsers while reading this email on gmail...


    Q2: Any ideas what may be going on here ? how to fix it ?


    Thanks a bunch !

  2. #2
    Join Date
    Dec 2007
    Posts
    4

    Default Re: HowTo set FormMail to send utf-8 messages

    I digged a bit deeper ... now it seems that there is double encoding going on inside formmail.php: below is the cut of the message as it is leaving webserver (notice that the MIME header is set correctly to utf-8, but the contents of the form (e.g. realname, message etc) are double encoded making "&" => "&" which is then not being displayed correctly by the email clients on the receiving end...



    Received: (from httpd@localhost)
    by web161.opentransfer.com (8.12.11.20060308/8.12.11) id lBK0Bu5b022188;
    Wed, 19 Dec 2007 18:11:56 -0600
    Date: Wed, 19 Dec 2007 18:11:56 -0600
    Message-Id: <200712200011.lBK0Bu5b022188@web161.opentransfer.com>
    To: temp@myusaauto.com
    Subject: Sample FormMail Testing
    From: Имя@sdf.cvb;;;;;; (=?utf-8?B?JiMxMDQ4OyYjMTA4NDsmIzExMDM7ICYjMTA1MDsmIzEwODM7JiMxMDgwOyYjMTA3NzsmIzEwODU7JiMxMDkwOyYjMTA3Mjs=?=)
    MIME-Version: 1.0 (produced by FormMail 8.03 from www.tectite.com)
    Content-Type: text/html; charset=UTF-8
    X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on localhost
    X-Spam-Status: No, score=0.3 required=5.0 tests=ALL_TRUSTED,HTML_30_40,
    HTML_MESSAGE,HTML_TEXT_AFTER_BODY,HTML_TEXT_AFTER_HTML,MIME_HTML_ONLY
    autolearn=disabled version=3.0.2
    X-Spam-Level:

    <html>
    <body>
    <p>Сообшение через форму вебсайта:</p>
    <table border="0">
    <tr>
    <td>Имя Клиента:</td>
    <td><b>&amp;#1048;&amp;#1084;&amp;#1103; &amp;#1050;&amp;#1083;&amp;#1080;&amp;#1077;&amp;#1085;&amp;#1090;&amp;#1072;</b></td>
    </tr>
    <tr>
    <td>Email address:</td>
    <td><b>&amp;#1048;&amp;#1084;&amp;#1103;@sdf.cvb</b></td>
    </tr>
    <tr>
    <td>Сообшение:</td>
    <td><b>&amp;#1048;&amp;#1084;&amp;#1103; &amp;#1050;&amp;#1083;&amp;#1080;&amp;#1077;&amp;#1085;&amp;#1090;&amp;#1072;&amp;#1048;&amp;#1084;&amp;#1103; &amp;#1050;&amp;#1083;&amp;#1080;&amp;#1077;&amp;#1085;&amp;#1090;&amp;#1072;&amp;#1048;&amp;#1084;&amp;#1103; &amp;#1050;&amp;#1083;&amp;#1080;&amp;#1077;&amp;#1085;&amp;#1090;&amp;#1072;<br />
    &amp;#1048;&amp;#1084;&amp;#1103; &amp;#1050;&amp;#1083;&amp;#1080;&amp;#1077;&amp;#1085;&amp;#1090;&amp;#1072;&amp;#1048;&amp;#1084;&amp;#1103; &amp;#1050;&amp;#1083;&amp;#1080;&amp;#1077;&amp;#1085;&amp;#1090;&amp;#1072;<br />
    <br />
    &amp;#1048;&amp;#1084;&amp;#1103; &amp;#1050;&amp;#1083;&amp;#1080;&amp;#1077;&amp;#1085;&amp;#1090;&amp;#1072;&amp;#1048;&amp;#1084;&amp;#1103; &amp;#1050;&amp;#1083;&amp;#1080;&amp;#1077;&amp;#1085;&amp;#1090;&amp;#1072;<br />
    &amp;#1048;&amp;#1084;&amp;#1103; &amp;#1050;&amp;#1083;&amp;#1080;&amp;#1077;&amp;#1085;&amp;#1090;&amp;#1072;&amp;#1048;&amp;#1084;&amp;#1103; &amp;#1050;&amp;#1083;&amp;#1080;&amp;#1077;&amp;#1085;&amp;#1090;&amp;#1072;</b></td>
    </tr>
    </table>
    </body>
    </html>
    Last edited by cepreu; 21-Dec-2007 at 04:58 AM. Reason: typos

  3. #3
    Join Date
    Dec 2007
    Posts
    4

    Default Re: HowTo set FormMail to send utf-8 messages

    OK here is what I think is happening:
    1. I noticed a correct output is displayed on receiving end when I am using keyboard(switched to foreign languege) to input text fields in a sampleform.htm
    2. The problem (see my post #2 above) is with the web-based translators - where the foreign language output (in a browser window e.g. see translit.ru just type something into the window - you will get russian output)... is then gets cut&pasted into the sampleform.htm fields... in this case [I think] the input is being put [into text fields] in a "&#XXX" format, where XXX is the char number) and because "&" is a special html char it then gets processed inside the php code [after clicking submit] to "&amp;" thus rendering the sequence of "#XXX" behind "&amp;" orphant and meaningless... which is then successfully being emailed over, received and displayed *without* conversion into the correct chars...

    ... I am not sure there is an easy fix for this
    any ideas out there ?

  4. #4
    Join Date
    Dec 2003
    Posts
    3,901

    Default Re: HowTo set FormMail to send utf-8 messages

    Hi,

    OK, FormMail definitely isn't expecting the input values to have HTML entities, such as И.

    It uses the builtin PHP function htmlspecialchars to ensure the HTML is valid.

    And yes, I think the encoding of the & will be the result.

    It seems that this PHP function doesn't understand existing HTML entities. Version 5.2.3 has an option to prevent double encoding. But that's not much help unless you have that or a later version of PHP.

    If you can run such a version, then we might be able to provide a fix for you.
    Russell Robinson - Author of Tectite FormMail and FormMailDecoder
    http://www.tectite.com/

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Please help with error messages... (cookies)
    By nhouse in forum FormMail Subscription Support
    Replies: 4
    Last Post: 09-Dec-2004, 05:20 PM
  2. Avoid feedback messages
    By NOgbourne in forum FormMail Subscription Support
    Replies: 3
    Last Post: 17-Nov-2004, 11:57 AM
  3. how do you set templateurl?
    By jloyzaga in forum FormMail Subscription Support
    Replies: 9
    Last Post: 26-Oct-2004, 10:36 AM
  4. How to set up the formmail.php file?
    By treborito in forum FormMail Subscription Support
    Replies: 1
    Last Post: 19-Oct-2004, 07:29 PM
  5. Help trying to set up a form to email and send info to file
    By rridsdale in forum FormMail Subscription Support
    Replies: 1
    Last Post: 14-Jan-2004, 03:38 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts