I work under strict and warnings. And I get this error:
Wide character in subroutine entry at /usr/local/share/perl/5.10.0/MIME/Lite.pm line 2259., referer:
Although I check for all arguments to be UTF-8, and they are utf8::valid, the error appears again and again. The $message does not arrive, but $name, $subject work fine.
$message = 'ćžćššš' (UTF-8) and it comes from CGI.pm input.
Anyone knows how to avoid correctly wide character in print in this case?
This is the code:
sub message {
my ($email, $from, $name, $message, $domain, $referer) = @_;
$message .= qq{\n\n---\nYour free service at http://example.com\n}
+;
utf8::decode($message);
utf8::upgrade($message);
utf8::decode($name);
utf8::upgrade($name);
$from = "=?UTF-8?B?" . encode_base64(encode("utf8", qq{"$name"}),
+"") . "?= <$from>";
my $subject = "New message from $referer";
$subject = "=?UTF-8?B?" . encode_base64(encode("utf8", qq{$subject
+}), "") . "?=";
utf8::decode($subject);
utf8::upgrade($subject);
my $msg = MIME::Lite->new(
From => $from,
To => "$email",
Subject => $subject,
Type => 'multipart/related'
);
$msg->attach(
Type => 'text/plain; charset=UTF-8',
Data => $message,
Encoding => "quoted-printable" );
$msg->attr("content-type.charset" => 'UTF8');
$msg->send;
page("Message sent. Thank you", qq{<p>Thank you very much. Your me
+ssage has been sent.<br/><br/>Go back to: <a href="$referer">$referer
+</a>});
}
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.