Your string is (HTML) entity-encoded (which you would have also seen by printing it. Either that's this webmail hoster doing this, or it is your program which sends it. I really wonder why you are trying to send email without knowing what your text is in. And why you are scraping the text content from some external web site.

So, your first step would be to make sure you know what encoding your subject string is in. If it is HTML entities, then HTML::Entities::decode can turn that into an UTF-8 string, which you can then in turn Base64-encode for the MIME subject header. But in reality, it would be much better to eliminate the HTML part of the equation and directly set the subject to some well-known characters in a well-known encoding yourself directly, for example by using:

my $subject = 'Hello World';

except using cyrillic charset, potentially in utf8 or KOI-8:

use utf8; my $subject = 'Hello World'; # except in cyrillic

or

use Encoding 'KOI-8'; my $subject = 'Hello World'; # except in cyrillic

if your source code editor supports KOI-8.


In reply to Re^7: Problem with russian / cyrillic in e-mail program. by Corion
in thread Problem with russian / cyrillic in e-mail program. by dbmathis

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.