Hi, Perl Monks,
I have a maillog file which contains Subject and From addresses with utf8.
Here's a bit of the maillog. Pls pay attention to Subject: and From:
mail_id: 3gTkbdw2YlQK, b: pru-s06Xc, Hits: 8.111, size: 40657, Subject
+: "Heritage The Latest & Most Luxurious Banquet Hall In Anuradhapura
+(raw: =?utf-8?Q?Heritage=20The=20Latest=20&=20Most=20Luxurious=20Banq
+uet=20Hall=20In=20Anuradhapura?=)", From: Heritage_Hotel_Anuradhapura
+_<ads@adzinair.net>_(raw:_=?utf-8?Q?Heritage=20Hotel=20Anuradhapura?=
+_<ads@adzinair.net>), X-Mailer: MailChimp_Mailer_-_**CID8fa1f72d0e77e
+89b5794**
I want to get it displayed in proper way. I still can't it. It STILL gives raw: =?utf-8?Q? etc..
I have added below lines to my perl code.
#!/usr/bin/perl
use CGI ':standard';
use strict;
use warnings;
use CGI::Carp 'fatalsToBrowser'; # use only for testing
print "Content-Type: text/html; charset=utf-8\n\n";
open FILE, '<:encoding(utf8)', '/var/log/mail.log' or die $!;
my @file = reverse <FILE>;
Anyway, I am reading the file in Revers Order. where hv I gone wrong?
I expect your answers. I hv been trying since yesterday evening. But, I still haven't succeeded.
I googled a lot. I came across some. I hope this url is useful.
https://en.wikibooks.org/wiki/Perl_Programming/Unicode_UTF-8
2018-07-11 Athanasius added code tags to maillog quote and linkified the Wikibooks link
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.