Solved

Sending japanese email using PEAR

Posted on 2004-09-21
6
268 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

Author Comment

by:thepadders
Comment Utility
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
Comment Utility
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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
How can I do this in Pyhton? 12 66
Build JSON from table records 17 38
PHP connection to remote AWS MySQL RDS 4 36
php image upload 3 24
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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 …

771 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