Solved

Sending japanese email using PEAR

Posted on 2004-09-21
6
269 Views
Last Modified: 2006-11-17
Hi there,

I am using Pears htmlMimeMail class and trying to send mail using this class. For now I am just editing the defaults of the class, which are:

$this->build_params['html_encoding'] = 'quoted-printable';
$this->build_params['text_encoding'] = '7bit';
$this->build_params['html_charset']  = 'ISO-8859-1';
$this->build_params['text_charset']  = 'ISO-8859-1';
$this->build_params['head_charset']  = 'ISO-8859-1';
$this->build_params['text_wrap']     = 998;

I changed these to:

$this->build_params['html_encoding'] = 'quoted-printable';
$this->build_params['text_encoding'] = 'base64';
$this->build_params['html_charset']  = 'UTF-8';
$this->build_params['text_charset']  = 'UTF-8';
$this->build_params['head_charset']  = 'UTF-8';
$this->build_params['text_wrap']     = 998;

which I thought would work but it does not seem to. While those values appear in the header for the email fine, the email just contains entitites instead of japanese characters (when viewed in Outlook). This is the same as what happens when I do not change any of the values above.

The example piece of japanese I am using is simply どうしようどうしよう

Any suggestions on how to accomplish this or what could be going wrong? There is nothing wrong with the japanese data getting into the email, it comes from the database but japanese text input, and display is working perfectly; it is just emailing that is broken.

Thank you.
0
Comment
Question by:thepadders
  • 3
  • 2
6 Comments
 

Author Comment

by:thepadders
ID: 12110437
Oh well it seems that japanese became entities here as well, thats what I am seeing in outlook and that is exactly the problem.
0
 
LVL 27

Accepted Solution

by:
Diablo84 earned 250 total points
ID: 12128511
Two things that i am aware of, 1 is that Japanese mail uses the full 8 bits in a byte rather then 7 as is usual so you may want to try '8bt' transfer encoding.

The other is that in order for the mail client to correctly interpret the mail body content it must be able to recognise to content type so you could try sending the charset as 'iso-2022-jp' .
0
 
LVL 9

Assisted Solution

by:techtonik
techtonik earned 250 total points
ID: 12148520
Are you sure you do have your text encoded in UTF-8?
Maybe there's no correct font in your system?
I'd like to see an example of input and output data in binary form if possible.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:thepadders
ID: 12149663
Hi,

I actually had two problems, the first is if you have Japanese text submitted from an English webpage, then browsers covert it into HTML entities. These need converting back into UTF-8 for it to work in an email (unless you use an HTML email of course) so I am working on that.

The other one was about some functions that where affecting the string, that needed removing when I was actually using japanese text.
0
 
LVL 9

Expert Comment

by:techtonik
ID: 12154536
What if you set UTF-8 in meta-info for your page to avoid conversion to entities?

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
0
 

Author Comment

by:thepadders
ID: 12154553
I was considering that, but there are a number of problems with storing everything in utf-8, especially some email readers that can handle utf-8, and you can't convert utf-8 back if you don't know what the language was; or that is as far as I know. I would love to do it all in utf-8 but not sure if its possible.

This is interesting from phpworks

http://www.derickrethans.nl/files/wereldveroverend-phpworks04.pdf
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now