Results 1 to 3 of 3

Thread: Evolution and non ASCII storage

Hybrid View

  1. #1
    Join Date
    Jun 2008
    Beans
    284

    Evolution and non ASCII storage

    I have an evolution filter that puts certain emails into a sub folder. Background programs then watch the associated folder
    ( /home/Name/.local/share/evolution/mail/local/.Queue/cur )
    and when an email arrives they process the information contained in the emails. You have to decode the stored email but it is normally pretty easy as most of the header is normally in plain ASCII (attachments are base64 encoded first). The problem is the subject line. Sometimes this is plain ASCII like:

    Subject: NISTXRAYREQ Thorium -pscaled

    but sometimes it's in this form:

    =?windows-1256?Q?NISTXRAYRE?= =?windows-1256?Q?Q_u_-pscal?=
    =?windows-1256?Q?ed=FE?=

    or this form:

    Subject: =?utf-8?B?TklTVFhSQVlSRVEgSXJvbiAtcHNjYWxlZA==?=

    Dependent on the client that sent the email. Now I am guessing these are some sort of alternative to ASCII used to cope with extended character sets. Does anyone know if this is right and ideally how to convert these lines into ASCII?

    O and I do know you can call a program from evolution. However I do quite a bit of processing on the email contents sometimes using bits from multiple emails so it's a lot easier to do this all outside evolution.
    Last edited by kaspar_silas; April 12th, 2013 at 09:57 AM. Reason: It's now solved
    I suffer from web impatience. You have 5 seconds to amaze me.

  2. #2
    Join Date
    Feb 2013
    Beans
    Hidden!

    Re: Evolution and non ASCII storage

    The ?Q? strings are in quoted-printable. You can decode it with qprint.
    The ?B? strings are in base64. Decode it with base64.

    Or do it with perl
    Code:
    $ perl -mEncode=decode -ne 'print decode("MIME-Header",$_)."\n"' <<<'=?windows-1256?Q?NISTXRAYRE?= =?windows-1256?Q?Q_u_-pscal?=  =?windows-1256?Q?ed?='
    NISTXRAYREQ u -pscaled
    $ perl -mEncode=decode -ne 'print decode("MIME-Header",$_)."\n"' <<<'Subject: =?utf-8?B?TklTVFhSQVlSRVEgSXJvbiAtcHNjYWxlZA==?='
    Subject: NISTXRAYREQ Iron -pscaled
    Last edited by schragge; April 11th, 2013 at 08:55 PM.

  3. #3
    Join Date
    Jun 2008
    Beans
    284

    Re: Evolution and non ASCII storage

    Excellent and thanks that makes perfect sense.
    (As most things do when someone tells you the answer)
    I suffer from web impatience. You have 5 seconds to amaze me.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •