Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Sending japanese email using PEAR

Posted on 2004-09-21
6
Medium Priority
?
280 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 1000 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 1000 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
Industry Leaders: 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!

 

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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

782 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