• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 508
  • Last Modified:

Japanese php contact form producing garbled emails

Hi there,

I am having difficulty building a php contact form which can handle Japanese characters.  Originally the script simply emailed the fields of the form to an address as plain text.  I was not surprised that this didn't work when Japanese characters were inserted, and so I have tried sending the form as a html email with character encoding set first to utf-8 and then to euc-jp, but neither produced the correct result.  Even when setting the encoding language within the email client to Japanese the result was garbled.  Perhaps the form itself needs to be set up in a special way?

Does anybody know of a place where I could have a look at some Japanese contact form php code to compare?

Many thanks.
  • 5
  • 3
1 Solution
maybe your computer doesn't have japanese chars installed, the easiest way to do it is to go to

website and download japanese language pack because word is used for outlook editing, hope this helps
by the way if this doesn't work then go to


that is the japanese global IME, i think it is to do with computer problems such as above
webexpectationsAuthor Commented:
Hi dan, thanks for your reply.

I'm fairly sure that I have the Japanese character pack installed, the website containing the contact form is multi-language and I can view the Japanese pages without any problem.  We believe the difficulty lies with the contact form itself, is this a possibility?
it is possible its in the form but yeah, im not that experienced, i just know that it could be a prob with your computer, if you send me the code, i can edit it and see by sending it to my email.
that could answer the prob
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

sorry,  my email is dan_272 [at] optusnet.com.au
webexpectationsAuthor Commented:
Here is the contact form:

<FORM name=form1 action=mail.php method=post enctype=multipart/form-data>
<input name="redirect" type="hidden" id="redirect" value="thankyou.html">
<TABLE cellSpacing=2 cellPadding=2 width='100%' border=0>
  <TR class=pictures>
    <TD><INPUT class=main id=name name=name></TD></TR>
  <TR class=pictures>
    <TD><INPUT class=main id=email name=email></TD></TR>
  <TR class=pictures>
    <TD><TEXTAREA class=main id=address name=address rows=5 wrap=VIRTUAL></TEXTAREA></TD>
  <TR class=pictures>
    <TD><INPUT class=main id=tel name=tel></TD>
  <TR class=pictures>
    <TD><TEXTAREA class=main id=message name=message rows=4 wrap=VIRTUAL></TEXTAREA></TD>
  <TR class=pictures>
    <TD><INPUT class=main type=submit value=Submit name=Submit></TD>

and here is the php script ('mail.php'):


$to = "georgey@webexpectations.com";
$subject = "Enquiry from EJC.co.uk website (Japanese)";
$headers = "From: website@ejc.co.uk\r\n";
$headers .= "Reply-To: website@ejc.co.uk\r\n";
$headers .= "Return-Path: website@ejc.co.uk\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=euc-jp\r\n";

header('Location: '. $redirect);

$content = "<html><body>";
$content .= "<h3>Enquiry form</h3>";
$content .= "Name: ".$name."<br>";
$content .= "Email: ".$email."<br>";
$content .= "Address: ".$address."<br>";
$content .= "Tel: ".$tel."<br>";
$content .= "Message: ".$message."<br>";
$content .= "</body></html>";

if ( mail($to,$subject,$content,$headers) ) {
   echo ".";
   } else {
   echo "!";


Any thoughts anyone?
webexpectationsAuthor Commented:
Have fixed this now.  By encoding the html email as utf-8, and encoding the language of the script itself as auto-select using notepad, I have then inserted a line of non-displayed (using style="display:none;") Japanese characters into the html email so that the email client interprets the output as Japanese even for a nearly empty form.

The headers problem was solved by using <META HTTP-EQUIV="refresh" content="0;URL=thankyou.html"> rather than header('Location: '. $redirect);.

Thank you for having a go, Dan.
no prob man
thankyou very much modulo, now i can ask my own questions!

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now