You are not logged in.

#1 2010-11-02 14:17:08

mr.entropy
Member
Registered: 2010-10-29
Posts: 10

[SOLVED] Character encoding conversion

Hi, my first post here...
I'm writing a shell script (using tcl/expect) to show mails on pop server.
How do I convert e-mail headers containing text like this:

Subject: =?iso-8859-1?B?ZGl2ZXJ0aW1lbnRvIHNlbnphIGZpbmUgMjQgb3JlIHN1IDI0?=

to make it readable?
I already tried with 'iconv' and 'recode' with no luck...
Thanks.

Last edited by mr.entropy (2010-11-02 16:34:39)

Offline

#2 2010-11-02 14:35:05

skanky
Member
From: WAIS
Registered: 2009-10-23
Posts: 1,847

Re: [SOLVED] Character encoding conversion

These subjects have (probably unnecessarily) been encoded according to RFC 2047.

The "B" in between the 2nd and 3rd ? indicates that it is encoded using Base64 (if there's a Q it's "Quoted-Printable" see RFC RFC 2045).

So you're looking for a Base64 decoder.

EDIT: and there happens to be one in coreutils.  smile

man base64

Last edited by skanky (2010-11-02 14:39:06)


"...one cannot be angry when one looks at a penguin."  - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle

Offline

#3 2010-11-02 14:36:42

enrique
Member
Registered: 2005-10-25
Posts: 95
Website

Re: [SOLVED] Character encoding conversion

You can check this: http://stackoverflow.com/questions/1260 … ail-header it should be enough to point you in the right direction wink


Kind regards, enrique

Offline

#4 2010-11-02 14:59:00

skunktrader
Member
From: Brisbane, Australia
Registered: 2010-02-14
Posts: 1,580

Re: [SOLVED] Character encoding conversion

echo "ZGl2ZXJ0aW1lbnRvIHNlbnphIGZpbmUgMjQgb3JlIHN1IDI0" | base64 -d
divertimento senza fine 24 ore su 24

Offline

#5 2010-11-02 16:34:09

mr.entropy
Member
Registered: 2010-10-29
Posts: 10

Re: [SOLVED] Character encoding conversion

Thank you guys, very quick solution smile

Offline

Board footer

Powered by FluxBB