From: Mike Fletcher Date: 2006-04-30T21:25:54+09:00 Subject: Re: How to decode the following string 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/.