PHP contact form in Flash with iso-8859-1 charset

I have made a flash contact form in PHP and everything is working fine, I receive the emails sent by the form, the only problem is that I'm french speaking and the content often includes special characters such as "è, é, à, ê, ..." and I they are displaying like that instead : Ã, ©, ...

below is my php code, I inserted a line to the header to tell that my charset is iso-8859-, but it doesn't work at all.  I also changed the charset to the page containing the flash movie, but it doesn't work either.

<?php
$sendTo = "test@test.com";
$subject = "subject";
$headers = "From: " . $_POST["FirstName"];
$headers .= "<" . $_POST["Email"] . ">\r\n"; 
$headers .= "Reply-To: " . $_POST["Email"] . "\r\n";
$headers .= "Return-Path: " . $_POST["Email"];
$headers .= 'Content-type: text/html; charset=iso-8859-1';
$message = $_POST["ToComments"];
mail($sendTo, $subject, $message, $headers); 
?>

Open in new window

spacialekAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Loganathan NatarajanLAMP DeveloperCommented:
try specifying the "charset=utf-8"

utf-8 for multilingual ...
0
Loganathan NatarajanLAMP DeveloperCommented:
surely it has to display now.. with this encoding charset...
0
Loganathan NatarajanLAMP DeveloperCommented:
also check mbstring configuration is enabled.. in order to display those french chars
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

spacialekAuthor Commented:
changing the charset to utf-8 doens't help..

where can I check if mbstring configuration is enabled ?  

thanks !
0
Loganathan NatarajanLAMP DeveloperCommented:
where can I check if mbstring configuration is enabled ?  

>> just print phpinfo() and check search mbstring* ... you should find the configuration settings...

mbstring
=========
Multibyte Support       enabled
Japanese support       enabled
Simplified chinese support       enabled
Traditional chinese support       enabled
Korean support       enabled
Russian support       enabled
Multibyte (japanese) regex support       enabled
0
spacialekAuthor Commented:
I asked to the technical support of my web hosting, and they confirm that mbstring is enabled...  
0
Loganathan NatarajanLAMP DeveloperCommented:
can you check whether those french character are entered valid ... ?

try put some sample french texts and display it...

it might work for utf-8 encoding o...
0
spacialekAuthor Commented:
yes the characters are valid, I use french sentences for testing, either with utf-8 and iso-8859-1
0
Loganathan NatarajanLAMP DeveloperCommented:
mmm.... not sure...

hope checked here also, $headers .= 'Content-type: text/html; charset=iso-8859-1';
(the utf-8)

--------------------------
then you can check this without Flash for just verification ..., i have worked with one multilingual feedback form to display those unicode character display.. not sure.....

sorry... i could not suggest further.,
0
spacialekAuthor Commented:
I don't understand what you mean by that : "hope checked here also, $headers .= 'Content-type: text/html; charset=iso-8859-1'; (the utf-8)"

the problem comes only when I use a flash form, I did I the past html forms without encoding problems...

0
Loganathan NatarajanLAMP DeveloperCommented:
ok.,

did you try this,

$headers .= 'Content-type: text/html; charset=utf-8';

(it might work, this what i already expressed)
0
spacialekAuthor Commented:
of course, it was the first thing that I did when I readed you first post :)  but it didn't solved the problem
0
Loganathan NatarajanLAMP DeveloperCommented:
Is it possible to print the values after posting from FLASH contact form? some thing like this,

print '<pre>';
print_r ($_POST);
print '<pre>';


check whether the chars are displayed properly or not
0
spacialekAuthor Commented:
I'm sorry but I don't know where to write those "print" commands ...  Do I have to write them into my php contact form or elsewhere ?
0
Loganathan NatarajanLAMP DeveloperCommented:
in the process php page.. .might be before you send the mail...

<?php
print '<pre>';
print_r ($_POST);
print '<pre>';
exit;
$sendTo = "test@test.com";
$subject = "subject";
$headers = "From: " . $_POST["FirstName"];
$headers .= "<" . $_POST["Email"] . ">\r\n";
$headers .= "Reply-To: " . $_POST["Email"] . "\r\n";
$headers .= "Return-Path: " . $_POST["Email"];
$headers .= 'Content-type: text/html; charset=iso-8859-1';
$message = $_POST["ToComments"];
mail($sendTo, $subject, $message, $headers);
?>

>>> check here, whether the content is still correct before we send it to mail... just check .. if problem here.. then we have look those flash input control encoding or something to be applied..
0
spacialekAuthor Commented:
when I do that, I don't receive the email anymore.
0
Loganathan NatarajanLAMP DeveloperCommented:
yes, you're right .. this is to just check ...

before the mail, whether we could see the chars correctly or not ... just to figure out problem from input or transmission to the mail...

got it?
0
Loganathan NatarajanLAMP DeveloperCommented:
<?
print '<pre>';
print_r ($_POST);
print '<pre>';
exit;
?

this will stay on your screen to see is what is posted on the page?
0
spacialekAuthor Commented:
ok it's supposed to display the message on the website ?  But the flash covers all the page, so I'm wondering where this is supposed to display..
0
Loganathan NatarajanLAMP DeveloperCommented:
oh.. don't you stop the process on the php process page ...?? any how you have to process the logics in php page as the mail function written page.. you can well stop and see the details...

as i said that could be executed and seen on browser from the php process page.. flash may not be loaded until you redirect or continue from php page..... anyhow just try this...

0
Loganathan NatarajanLAMP DeveloperCommented:
as a whole I could see the problem could be, due to UTF-8 or mbstring() config.. not sure how to figure out on that unless to see the code/pages..?
0
Loganathan NatarajanLAMP DeveloperCommented:
i'm moving now.,
0
julianopolitoCommented:
<?php
$sendTo = "test@test.com";
$subject = "subject";
$headers = "From: " . utf8_decode($_POST["FirstName"]);
$headers .= "<" . utf8_decode($_POST["Email"] ). ">\r\n";
$headers .= "Reply-To: " . utf8_decode($_POST["Email"] ). "\r\n";
$headers .= "Return-Path: " . utf8_decode($_POST["Email"]);
$headers .= 'Content-type: text/html; charset=iso-8859-1';
$message = utf8_decode($_POST["ToComments"]);
mail($sendTo, $subject, $message, $headers);
?>

Text comes from flash in utf8 format, you need to decode those to use. Try those and let me know.

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
spacialekAuthor Commented:
Thanks to julianopolito for the solution, it works very well now !  
Thanks a lot to logudotcom, you offered me a great support !
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.