Dear monks, I thought I got a grip on UTF8, reading files and sending emails and merrily started to work on Polish translations only to be greeted with strange characters in Outlook mail client. I come back here humbled.
So to state the problem:

1. To enable several people from several countries to type in several languages, it was decided to store the data like so in a separate text file.
German:

$subjectLine= Ihre Rechnung f0XC30XBCr transaktion ###transactionID### $line= Mit freundlichen Gr0XC30XBCssen
( The u with umlaut is stored as corresponding UTF8 codepoint.)

2. I then read the line like so:

$encValue=decode('UTF-8', $line); $encValueSubject=decode('UTF-8', $subjectLine);

3. I create a PDF using PDF:API2 with UTF-8 encoding and the file is stored in $pdfout.

4. I then used the following code to send email:

use Mail::Sender; my $mfrom = $mailFrom ; my $pdfmail = new Mail::Sender {from => $mfrom,smtp => 'localh +ost'}; $pdfmail->MailFile({to => $cemail, subject => $subjectLine, msg => $line."\n", file => $pdfout});

All this works fine for German, Swedish, Norwegian and Danish. Outlook displays everything in the mail correctly.

However, for Polish and Czech , the characters are garbled in the subject line and in the body of the mail. The newlines are also missing in some mails.

Sample text for Czech:

$subjectLine=P0XC50X990XC30XADstup k internetu Wi-Fi $line = S p0XC50X990XC30XA1telskymi pozdravy,

I am using Mail::Sender , gone through every type of setting ( like b_charset, b_encoding etc and nothing seems to work)
Am I missing something fundamental here?


In reply to UTF-8 Email - German, Swedish Ok...Polish,Czech fails by MonkeyMonk

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.