For Programmers: Free Programming Magazines  


Home > Archive > PERL Modules > March 2004 > sending chinese character emails via Net::SMTP using Mime-tools









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author sending chinese character emails via Net::SMTP using Mime-tools
James O'Brien

2004-03-19, 12:55 pm

Howdi,
I want to send chinese character emails via Net::SMTP perl. Is the
most reliable format MIME encoding? If so, and I have a stream of
characters (lets say utf-8), do I just Mime encode them quoted
printable and let the client mail application interpret? Anyone been
through this process?
Thanks,
--jim
pkent

2004-03-19, 12:55 pm

In article <47a3b6fd.0403051048.58fe450b@posting.google.com>,
jobrien@techtarget.com (James O'Brien) wrote:

> I want to send chinese character emails via Net::SMTP perl. Is the
> most reliable format MIME encoding? If so, and I have a stream of
> characters (lets say utf-8), do I just Mime encode them quoted
> printable and let the client mail application interpret? Anyone been
> through this process?


While I don't actually have an answer, amazingly enough I'm interested
in a similar problem, including how I can easily _de_code mails that may
contain UTF8 data.

Having a look on the web...
http://www.mhonarc.org/ - deals with mail and seems to know about UTF8
http://www.perldiscuss.com/article....up=perl.unicode
http://search.cpan.org/~eryq/MIME-t...b/MIME/Tools.pm

might be of some interest

I'd suspect that a robust way of sending UTF8 content is to use a
content transfer encoding of base64 and a content type of 'text/plain;
charset=utf-8' but I can't find any references to that online so it may
not be correct. But if anyone here know I'd certainly be interested in
finding the correct way.

P

--
pkent 77 at yahoo dot, er... what's the last bit, oh yes, com
Remove the tea to reply
James O'Brien

2004-03-19, 12:55 pm

> I'd suspect that a robust way of sending UTF8 content is to use a
> content transfer encoding of base64 and a content type of 'text/plain;
> charset=utf-8' but I can't find any references to that online so it may
> not be correct. But if anyone here know I'd certainly be interested in
> finding the correct way.
>
> P


I received the following answer from another group (comp.mail.misc)
writes:


Correct. Don't forget to insert the "Mime-Version: 1.0" and
"Content-Type:
text/plain; charset=utf-8" headers.

If your SMTP server advertizes "8BITMIME", don't even bother with
quoted-printable (unless it's Qmail). Just use
"Content-Transfer-Encoding:
8bit", and forget the whole thing.

You might run into a mail client that doesn't grok utf-8. In that
case, you
will need to transcode your content to big-5 or gb2312 (or something
similar), and adjust the headers accordingly.


====
The part that worries me is the last paragraph. Judging from that and
other stuff I've read (since I might be dealing with a variety of
clients/mail servers), I might want to use gb2312(the windows
simplified chinese) and quoted-printable or base64 - like you said.
Not sure which is preferrable. base64 seems more standard.
The Mime::Tools and maybe even Mime::Lite (I assume) will handle the
encoding.
I'll keep you posted.
Alan J. Flavell

2004-03-19, 12:55 pm

On Mon, 8 Mar 2004, James O'Brien wrote:

> I might want to use gb2312(the windows
> simplified chinese)


I've seen complaints, from folks who read Chinese, about the
relatively poor quality of the code mapping between Unicode and the
various Chinese encodings. Sorry, I cannot comment directly on those
complaints, I'm only mentioning them as they seemed to come from
credible sources.

> and quoted-printable or base64 - like you said.
> Not sure which is preferrable.


Basic guideline: use base64 for encoding stuff that mostly isn't in
ASCII. Use quoted-printable for encoding stuff that -is- mostly in
ASCII.

> base64 seems more standard.


Both are "standard". But quoted-printable is very wasteful if a large
proportion of bytes to be encoded have the high bit set.

James O'Brien

2004-03-19, 12:55 pm

> Basic guideline: use base64 for encoding stuff that mostly isn't in
> ASCII. Use quoted-printable for encoding stuff that -is- mostly in
> ASCII.
>
>
> Both are "standard". But quoted-printable is very wasteful if a large
> proportion of bytes to be encoded have the high bit set.


Good to know - thanks for the help.
--jim
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com