Curt,
Thank you very much for the help. I did use JavaMail API, and I set the from and subject in the following way:
Message newMessage = new MimeMessage(session);
newMessage.setFrom(new InternetAddress(emailFromAddress, "some japanese name", "ISO-2022-JP"));
newMessage.setSubject(subject, "ISO-2022-JP");
Then I went ahead to set the content type header:
newMessage.setHeader("Content-Type", "text/plain;charset=ISO-2022-JP");
The program works fine for Vodaphone, Docomo and one ezweb phone. But not for the AU/Ezweb A3012CA. I did try to send Japanese through Microsoft outlook and it works fine with that A3012CA phone. So apparently I missed something in my code......
Thanks,
Kevin
-----Original Message-----
From: Curt Sampson [mailto:cjs@cynic.net]
Sent: Wed 8/18/2004 10:10 PM
To: Kevin Chen
Cc: keitai-l@appelsiini.net
Subject: Re: (keitai-l) Japanese email for ezweb A3012CA
On Wed, 18 Aug 2004, Kevin Chen wrote:
> I'm trying to send emails to ezweb phones. The encoding I'm using
> is ISO-2022-JP, I set encoding for message body, subject and
> from address. Content type is set as "Content-Type: text/plain;
> charset=ISO-2022-JP". For one ezweb phone, AU/Ezweb C413S, all three
> fields show up in Japanese correctly. But for A3012CA, the From and
> Subject fields cannot display Japanese while the message body displays
> the Japanese message fine.
The Content-type header line is for the body only; it does not apply to
any of the headers. For the headers, you have to use MIME header encoding.
So instead of this in ISO-2022-JP
Subject: ?????
you would need this:
Subject: =?ISO-2022-JP?B?GyRCJSshPCVIJGgkahsoQg==?=
It's encoded as follows:
"=?" + charset-name + "?" + encoding + "?" + data + "?="
where the encoding is "B" for base-64 data and "Q" for quoted-printable
data.
See the MIME RFCs for full details.
Many languages have libraries that will put together this stuff for you
(e.g., JavaMail), but if it's along the lines of the simple example
above, it's easy enough to do yourself so long as you have a base-64
conversion function.
cjs
--
Curt Sampson <cjs_at_cynic.net> +81 90 7737 2974 http://www.NetBSD.org
Don't you know, in this new Dark Age, we're all light. --XTC
Received on Thu Aug 19 06:20:36 2004