Evaggelos Balaskas - System Engineer

The sky above the port was the color of television, tuned to a dead channel

Blog
Posts
Wiki
About
Contact
rss.png twitter linkedin github gitlab profile for ebal on Stack Exchange

ebalaskas: otenet ntp server: time.otenet.gr »
  -  
« ebalaskas: Decode any subject encoding...
Apr
30
2011
Decode any subject encoding to utf8 with perl
Posted by ebal at 22:39:08 in planet_ellak

Είναι αρκετές οι φορές που κοιτώ το Subject ενός mail για να ελέγξω εάν είναι SPAM ή όχι.
Τι γίνεται όμως, εάν το subject δεν είναι σε ASCII ?

Γιατί γίνεται αυτό: Encoded-Word

Για να μπορώ γρήγορα κι εύκολα να διαβάσω το θέμα ενός τέτοιου email,
έγραψα ένα προγραμματάκι σε perl


#!/usr/bin/env perl

die $0 =~ /([^/]+)$/, " <base64 mail subject> n" unless @ARGV == 1;

use Encode;
use MIME::Base64 qw(decode_base64);

my @values = split ( '?', $ARGV[0] );
binmode STDOUT, ":utf8";
print decode ( $values[1] , decode_base64( $values[3] ) . "n" );

Δίνω ένα παράδειγμα:

$ ./db64.pl =?utf8?B?zqPOlc6czpnOnc6RzqHOmc6RIM6UzpnOn86ZzprOl86jzpfOoyAtIE1BUktFVElORyAtIM6gzpvOl86hzp/Ops6fzqHOmc6azpfOoyAmIM6ozqXOp86fzpvOn86TzpnOkc6jIC0gzpzOkc6qzp/OoyAyMDEx?=

ΣΕΜΙΝΑΡΙΑ ΔΙΟΙΚΗΣΗΣ - MARKETING - ΠΛΗΡΟΦΟΡΙΚΗΣ & ΨΥΧΟΛΟΓΙΑΣ - ΜΑΪΟΣ 2011

ebalaskas: otenet ntp server: time.otenet.gr »
  -  
« ebalaskas: Decode any subject encoding...

Search

Admin area

  • Login

Categories

  • blog
  • wiki
  • pirsynd
  • midori
  • books
  • archlinux
  • movies
  • xfce
  • code
  • beer
  • planet_ellak
  • planet_Sysadmin
  • microblogging
  • UH572
  • KoboGlo
  • planet_fsfe

Archives

  • 2025
    • April
    • March
    • February
  • 2024
    • November
    • October
    • August
    • April
    • March
  • 2023
    • May
    • April
  • 2022
    • November
    • October
    • August
    • February
  • 2021
    • November
    • July
    • June
    • May
    • April
    • March
    • February
  • 2020
    • December
    • November
    • September
    • August
    • June
    • May
    • April
    • March
    • January
  • 2019
    • December
    • October
    • September
    • August
    • July
    • June
    • May
    • April
    • March
    • February
    • January
  • 2018
    • December
    • November
    • October
    • September
    • August
    • June
    • May
    • April
    • March
    • February
    • January
  • 2017
    • December
    • October
    • September
    • August
    • July
    • June
    • May
    • April
    • March
    • February
    • January
  • 2016
    • December
    • November
    • October
    • August
    • July
    • June
    • May
    • April
    • March
    • February
    • January
  • 2015
    • December
    • November
    • October
    • September
    • August
    • July
    • June
    • May
    • April
    • March
    • January
  • 2014
    • December
    • November
    • October
    • September
    • August
    • July
    • June
    • May
    • April
    • March
    • February
    • January
  • 2013
    • December
    • November
    • October
    • September
    • August
    • July
    • June
    • May
    • April
    • March
    • February
    • January
  • 2012
    • December
    • November
    • October
    • September
    • August
    • July
    • June
    • May
    • April
    • March
    • February
    • January
  • 2011
    • December
    • November
    • October
    • September
    • August
    • July
    • June
    • May
    • April
    • March
    • February
    • January
  • 2010
    • December
    • November
    • October
    • September
    • August
    • July
    • June
    • May
    • April
    • March
    • February
    • January
  • 2009
    • December
    • November
    • October
    • September
    • August
    • July
    • June
    • May
    • April
    • March
    • February
    • January
Ευάγγελος.Μπαλάσκας.gr

License GNU FDL 1.3 - CC BY-SA 3.0