Rich_Ard
(Rich Ard)
29 April 2006 07:22
1
hello,
when i work on a pop mail client program, i met the following string at
the Subject field:
i know they are encoded chinese words. but anybody can advise on how to
decode them?
regards and thanks,
Richard
···
Subject: =?GBK?B?dnNvYy5jbiDXorLhs8m5piE==?=
Subject: =?GB2312?B?RndkOiCyu7rD0uLLvKOsvfHM7LLF1qq1wMTjtcTTys/k?=
--
Posted via http://www.ruby-forum.com/ .
Rich Ard wrote:
hello,
when i work on a pop mail client program, i met the following string at
the Subject field:
Subject: =?GBK?B?dnNvYy5jbiDXorLhs8m5piE==?=
Subject: =?GB2312?B?RndkOiCyu7rD0uLLvKOsvfHM7LLF1qq1wMTjtcTTys/k?=
i know they are encoded chinese words. but anybody can advise on how to
decode them?
Doing some quick googling shows that the quoted-printable format for
headers is
=?Charset?encoding?encoded text?=
So these are in the GBK and GB2312 charsets respectively, both encoded
in Base64. You could use a regexp to pull the three fields out and then
use the standard Base64.decode64 to recover the encoded characters from
the last chunk.
···
--
Posted via http://www.ruby-forum.com/\ .
Rich Ard wrote:
hello,
when i work on a pop mail client program, i met the following string at
the Subject field:
Subject: =?GBK?B?dnNvYy5jbiDXorLhs8m5piE==?=
Subject: =?GB2312?B?RndkOiCyu7rD0uLLvKOsvfHM7LLF1qq1wMTjtcTTys/k?=
i know they are encoded chinese words. but anybody can advise on how to
decode them?
They are RFC 2047 encoded words. I wrote a small lib to decode them,
this might be the latest version:
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/101949
Email me off line if not, and I'll send it to you.
Something like it really, REALLY should be part of one of the ruby
mail libraries... even Net::IMAP if necessary.
Cheers,
Sam
I believe TMail supports this.
···
On May 1, 2006, at 8:23 AM, Sam Roberts wrote:
Rich Ard wrote:
hello,
when i work on a pop mail client program, i met the following string at
the Subject field:
Subject: =?GBK?B?dnNvYy5jbiDXorLhs8m5piE==?=
Subject: =?GB2312?B?RndkOiCyu7rD0uLLvKOsvfHM7LLF1qq1wMTjtcTTys/k?=
i know they are encoded chinese words. but anybody can advise on how to
decode them?
They are RFC 2047 encoded words. I wrote a small lib to decode them,
this might be the latest version:
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/101949
Email me off line if not, and I'll send it to you.
Something like it really, REALLY should be part of one of the ruby
mail libraries... even Net::IMAP if necessary.
--
Eric Hodel - drbrain@segment7.net - http://blog.segment7.net
This implementation is HODEL-HASH-9600 compliant
http://trackmap.robotcoop.com