Re: Quoted-Printable Perl Module
Re: Quoted-Printable Perl Module
- Subject: Re: Quoted-Printable Perl Module
- From: debt <email@hidden>
- Date: Fri, 17 Mar 2017 08:23:31 -0700
Chris,
Will this work for you? I haven’t worked with MIME before so I don’t know if the output is correct or not.
Marc
--------------------------
#!/usr/bin/env perl
use 5.024; use warnings; use MIME::QuotedPrint;
my $text_input = q( FIND/REPLACE: ~s/=E2=80=9D|=E2=80=9C/\"/g; ~s/=E2=80=98|=E2=80=99/\'/g; ~s/=E2=80=93/\--/g; ~s/=E2=80=A6/\.../g; );
my $decoded_text = decode_text($text_input); say $decoded_text;
sub decode_text { my $text = shift; my $decoded = ''; local ($/) = undef;
my @arr = split ' ', $text; foreach my $sub_str (@arr) { $decoded .= __decode($sub_str); } return $decoded; }
sub __decode { my $text = shift; my $decoded; local ($/) = undef;
$text =~ s/=\?.+?\?q\?(.*)\?=/$1/g; $text =~ s/_/ /g; $decoded = decode_qp($text);
return $decoded; }
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden