Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

PHP Email Subject - in Japanese?

Enthusiast ,
Feb 06, 2012 Feb 06, 2012

Bit of an odd one, I know...

I've done a little site in Japanese, and everything works fine, apart from one thing...

I have a mail script for the contact form, but the Japanese tect I've entered for the email subject is incorrectly displaying as ありがとうございます。.

Its fine in English, just not liking the Japanese.

The code looks like:

//start Trigger_SendEmail1 trigger

//remove this line if you want to edit the code by hand

function Trigger_SendEmail1(&$tNG) {

  $emailObj = new tNG_Email($tNG);

  $emailObj->setFrom("info@mywebsite.jp");

  $emailObj->setTo("{email}");

  $emailObj->setCC("");

  $emailObj->setBCC("");

  $emailObj->setSubject("ありがとうございます。");

  //WriteContent method

  $emailObj->setContent("{firstname} 様<br /><br />この度はヒーリングハウス ハイジへのお問い合わせありがとうございます。<br /><br />スタッフが折り返し連絡しますので、今しばらくお待ち下さい。<br /><br />ヒーリングハウス ハイジ");

  $emailObj->setEncoding("ISO-8859-1");

  $emailObj->setFormat("HTML/Text");

  $emailObj->setImportance("Normal");

  return $emailObj->Execute();

}

//end Trigger_SendEmail1 trigger

If anyone has any suggestions to get the subject to display correctly in the Japanese, that would be much appreciated!

TOPICS
Server side applications
757
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 07, 2012 Feb 07, 2012
LATEST

The problem is that you're using Western European encoding, which supports only a limited range of characters. You should be able to use UTF-8 encoding:

Change this:

$emailObj->setEncoding("ISO-8859-1");

to this:

$emailObj->setEncoding("UTF-8");

If that doesn't work, try this:

$emailObj->setEncoding("Shift-JIS");

Shift-JIS is a Japanese-specific encoding. UTF-8 is Unicode, which supports most writing systems, including Japanese.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines