Struggling with accented characters

Post Reply
greer
Posts: 10
Joined: Mon Nov 01, 2010 12:49 pm

Struggling with accented characters

Post by greer »

Hello,
We are building enrollment forms where users frequetly enter accented characters, which is fine until it comes time to email confirmations, etc.

When passing from vortex to sendmail, "hard-coded" accented characters show up fine, but in any variables the accented characters are garbled.

We have tried both emailing directly from the form submission, and writing the values to the database first, then retrieveing them, and sending. (The accented characters get written to the database fine, still look fine when retrieved, but look garbled once passed to sendmail.
--

example where USERNAME contains: àâäèéê

<SQL ROW "SELECT USERNAME FROM REGFORM where id = '4f7d6acd112d'"></SQL>
<send $USERNAME> // Produces: àâäèéê

<sum "%s" 'Prénom: ' $USERNAME>
<$BODY = $ret>
<$TO = 'user@email.com'>
<$FROM = 'user@unhcr.org'>
<$SUBJECT = 'testing'>

<exec BKGND /usr/lib/sendmail -t -n>
From: UNHCR <$FROM>
To: $TO
Subject: $SUBJECT
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
<fmt "%s" $BODY>
</exec>

// Produces: Prénom: ÃâäÃ&#776;Ã
// NB. (The "hard-coded" accent in "Prénom" shows correctly, but the user-submitted variable is garbled.)

--

Another example where data is used straight from an HTML form:

<form name="reg_form" id="reg_form" action="regsystem" method="post">
<input type="text" name="USERNAME" id="USERNAME" value="àâäèéê" />
<input type="submit" value="Soumettre" />
</form>

- and on the resulting page -

<if $USERNAME neq "">
<send $USERNAME> // Produces: àâäèéê

<sum "%s" 'Prénom: ' $USERNAME>
<$BODY = $ret>
<$TO = 'user@email.com'>
<$FROM = 'user@unhcr.org'>
<$SUBJECT = 'testing'>

<exec BKGND /usr/lib/sendmail -t -n>
From: UNHCR <$FROM>
To: $TO
Subject: $SUBJECT
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
<fmt "%s" $BODY>
</exec>

// Produces: Prénom: ÃâäÃ&#776;Ã

</if>

--

Any ideas on where we are going wrong? Thanks!
User avatar
John
Site Admin
Posts: 2597
Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH
Contact:

Struggling with accented characters

Post by John »

I think what is happening is that the HTML form submit send UTF-8 encoded accents, however in your email you are defining ISO-8859-1. If you try the email as UTF-8 instead of ISO-8859-1 does that work better?
John Turnbull
Thunderstone Software
greer
Posts: 10
Joined: Mon Nov 01, 2010 12:49 pm

Struggling with accented characters

Post by greer »

Hi John,

Thanks for that, it's given us enough information to solve the problem.

Cheers!

BTW, I posted this on behalf of one of my team as he was trying to use your Forgot Password link and it doesn't appear to be working.
User avatar
mark
Site Admin
Posts: 5513
Joined: Tue Apr 25, 2000 6:56 pm

Struggling with accented characters

Post by mark »

Also use <fmt "%s" ...> for from, to, and subject to avoid HTML escapement as you did for body.

Check your spam folder for mail from @master.com.
Post Reply