Link to home
Start Free TrialLog in
Avatar of spacialek
spacialekFlag for Canada

asked on

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

Avatar of Loganathan Natarajan
Loganathan Natarajan
Flag of India image

try specifying the "charset=utf-8"

utf-8 for multilingual ...
surely it has to display now.. with this encoding charset...
also check mbstring configuration is enabled.. in order to display those french chars
Avatar of spacialek

ASKER

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

where can I check if mbstring configuration is enabled ?  

thanks !
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
I asked to the technical support of my web hosting, and they confirm that mbstring is enabled...  
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...
yes the characters are valid, I use french sentences for testing, either with utf-8 and iso-8859-1
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.,
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...

ok.,

did you try this,

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

(it might work, this what i already expressed)
of course, it was the first thing that I did when I readed you first post :)  but it didn't solved the problem
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
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 ?
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..
when I do that, I don't receive the email anymore.
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?
<?
print '<pre>';
print_r ($_POST);
print '<pre>';
exit;
?

this will stay on your screen to see is what is posted on the page?
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..
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...

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..?
i'm moving now.,
ASKER CERTIFIED SOLUTION
Avatar of julianopolito
julianopolito
Flag of Brazil image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks to julianopolito for the solution, it works very well now !  
Thanks a lot to logudotcom, you offered me a great support !