C
C
Cat_CooLeR2014-03-12 22:05:27
Perl
Cat_CooLeR, 2014-03-12 22:05:27

Perl library for decoding - is there a ready-made solution?

All the best!
Sorry if this question has been asked, I couldn't find an answer to it.
In Perl, through the Net::IMAP::Simple library, I get email subjects in the following form:

=?windows-1251?B?yuDqIOTuIOLg8SDk7vXn4u7t6PLx/w==?=

=?koi8-r?B?8NLBytMtzMnT1CDEzNEg4czYwsXS1ME=?=

=?UTF-8?B?0J3QtdC00L7RgdGC0LDQstC70LXQvdC90L7QtSDRgdC+0L7QsdGJ0LXQvdC40LU=?=

=?koi8-r?B?z9TXxdQgzsEg2sHLwdo=?=

=?windows-1251?B?8eIg4OLy7iDv8ODp8Q==?=

=?koi8-r?B?9OXNwXRlc3TUxQ==?=

Is there a ready-made solution for translating strings to a human-readable form, so as not to make a bicycle?
Also, strings like =?koi8-r?B?9OXNwXRlc3TUxQ==?= - contain both Cyrillic and Latin.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2014-03-13
@Cat_CooLeR

use Encode qw(decode);
print decode("MIME-Header", 'Subject: =?windows-1251?B?yuDqIOTuIOLg8SDk7vXn4u7t6PLx/w==?=')."\n";
print decode("MIME-Header", 'Subject: =?koi8-r?B?8NLBytMtzMnT1CDEzNEg4czYwsXS1ME=?=')."\n"
print decode("MIME-Header", 'Subject: =?UTF-8?B?0J3QtdC00L7RgdGC0LDQstC70LXQvdC90L7QtSDRgdC+0L7QsdGJ0LXQvdC40LU=?=')."\n";

Subject: Как до вас дохзвонится
Subject: Прайс-лист для Альберта
Subject: Недоставленное сообщение

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question