Welcome to MobyThreads.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in
All support for the MobyThreads Threaded phpBB MOD can now be found on welsolutions at this forum

Accented Characters with html Form

 
   Web Hosting and Web Master Forums (Home) -> Webmaster RSS
Next:  URL and security  
Author Message
tochiro

External


Since: Feb 15, 2006
Posts: 7



(Msg. 1) Posted: Tue Apr 10, 2007 6:09 am
Post subject: Accented Characters with html Form
Archived from groups: alt>www>webmaster (more info?)

Hello,

I have a problem with accented characters written by visitors of my
web page on a contact form. These characters are converted to weird
signs and I do not understand why.

The page with the contact form is written in French with the following
charset:
<meta http-equiv="content-type" content="text/html;
charset=iso-8859-1" />

The form data are sent to a PHP page. Here is part of the PHP code:
$formContent = "Email: ".$_POST['email']."\n"
."Name: ".$_POST['name']."\n"

mail($myEmail,$subject,$formContent,"From: $myEmail\nReply-To:
$myEmail\nCc: $me");

What sould I do? Thank you for your advice.

Cheers

 >> Stay informed about: Accented Characters with html Form 
Back to top
Login to vote
tochiro

External


Since: Feb 15, 2006
Posts: 7



(Msg. 2) Posted: Tue Apr 10, 2007 7:59 am
Post subject: Re: Accented Characters with html Form [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Tue, 10 Apr 2007 12:38:01 +0100, Toby A Inkster
<usenet200703.DeleteThis@tobyinkster.co.uk> wrote:

>tochiro wrote:
>
>> The page with the contact form is written in French with the following
>> charset:
>> <meta http-equiv="content-type" content="text/html;
>> charset=iso-8859-1" />
>
>But what does the real HTTP Content-Type header say?

Thank you for your help. I am not sure I understand your question
above. How can I check the real header?

 >> Stay informed about: Accented Characters with html Form 
Back to top
Login to vote
Toby A Inkster

External


Since: Mar 06, 2007
Posts: 58



(Msg. 3) Posted: Tue Apr 10, 2007 12:38 pm
Post subject: Re: Accented Characters with html Form [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

tochiro wrote:

> The page with the contact form is written in French with the following
> charset:
> <meta http-equiv="content-type" content="text/html;
> charset=iso-8859-1" />

But what does the real HTTP Content-Type header say?

> mail($myEmail,$subject,$formContent,"From: $myEmail\nReply-To:
> $myEmail\nCc: $me");

You should send a similar Content-Type header in your e-mail headers too,
and also I'd recommend using a quoted-printable transfer encoding.

$headers = "From: $myEmail\r\n"
. "Reply-To: $myEmail\r\n
. "Cc: $me\r\n"
. "MIME-Version: 1.0\r\n";
. "Content-Type: text/plain; charset=iso-8859-1\r\n"
. "Content-Transfer-Encoding: quoted-printable";
mail($myEmail,$subject,quoted_printable_encode($formContent),$headers);

Bizarrely, the quoted_printable_encode() function isn't included in the
standard PHP distribution (which only has a decode function!) but there are
a few example implementations of it here:

http://uk2.php.net/manual/en/function.quoted-printable-decode.php

Alternatively, if you have PHP's IMAP extension installed (check phpinfo
to see if you do) then you can use the imap_8bit() function:

$headers = "From: $myEmail\r\n"
. "Reply-To: $myEmail\r\n
. "Cc: $me\r\n"
. "MIME-Version: 1.0\r\n";
. "Content-Type: text/plain; charset=iso-8859-1\r\n"
. "Content-Transfer-Encoding: quoted-printable";
mail($myEmail,$subject,imap_8bit($formContent),$headers);

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!
 >> Stay informed about: Accented Characters with html Form 
Back to top
Login to vote
Toby A Inkster

External


Since: Mar 06, 2007
Posts: 58



(Msg. 4) Posted: Tue Apr 10, 2007 3:54 pm
Post subject: Re: Accented Characters with html Form [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

tochiro wrote:

> How can I check the real header?

http://www.w3.org/International/questions/qa-headers-charset

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!
 >> Stay informed about: Accented Characters with html Form 
Back to top
Login to vote
tochiro

External


Since: Feb 15, 2006
Posts: 7



(Msg. 5) Posted: Tue Apr 10, 2007 5:50 pm
Post subject: Re: Accented Characters with html Form [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Tue, 10 Apr 2007 15:54:01 +0100, Toby A Inkster
<usenet200703.DeleteThis@tobyinkster.co.uk> wrote:
>
>http://www.w3.org/International/questions/qa-headers-charset

Thanks a lot Smile
 >> Stay informed about: Accented Characters with html Form 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Translated Sites and HTML Characters - When creating a website in a language other than English, should I use the HTML character entities to depict letters such as &#246; = ö or should I just type in the character ö directly. -- JayB

form to html - Is there a simple application that can create an html document on the fly? The user would only have to fill out a form .. and then the app would generate the document. No archives, no admin interface .. just form to html app .. thanks -- ..

html email form on Win XP SP2? - It seems that webpages rendered on a Win XP SP2 machine are not functioning when it comes to emailing a filled-out form. Does anybody know a work-around for this problem? thanx... Frank

submit email through a html form using ssi - hi all webmasters, i don't know anything about ssi. does anyone know how to submit email through a html form using ssi? the reason is that united.net.kg doesn't support php and cgi. a step by step guide will be appreciated. marco

Looking for a Javascript - Accented Character insertion - Hi all; I'm not sure how to word this for a google search, so I thought I'd just go right to this NG. I have a site I'm about to start creating a massive CMS for (Perl/MySQL), but it's got both an English and a French side to the site that will need...
   Web Hosting and Web Master Forums (Home) -> Webmaster All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]