Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Sending japanese email using PEAR

Posted on 2004-09-21
6
Medium Priority
?
279 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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

Tutorial: Introduction to Managing a Linux Server

In this tutorial on systemd, we will explore:
-OS/Distro Adoption
-chkconfig and Other Legacy Commands
-Summary and Key Commands

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.
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 look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

730 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