1 2 3 4
require MIME::QuotedPrint; my $dec = MIME::QuotedPrint::decode_qp('=E2=9C=A9'); require HTML::Entities; say HTML::Entities::encode_entities($dec);
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
use strict; use warnings; use 5.010; my $encoded = 'Subject: =?utf-8?Q?=C3=84=C3=96=C3=9C=C3=9F=C2=B5?='; # ist 'Subject: ÄÖÜßµ' als QP kodiert use MIME::Words qw(decode_mimewords); # Aus MIME Quotedprintable in eine Bytekette my $decoded = decode_mimewords($encoded); use Encode; # die Bytekette ins Perl-String-Format zurück $decoded = decode_utf8($decoded); # für die DOS-Konsole richtig als CP850 ausgeben say encode('CP850',$decoded); use HTML::Entities; # als HTML Zeichen kodieren say encode_entities($decoded);
1 2 3 4 5 6 7 8 9
#!/usr/bin/perl use strict; use warnings; use Fcntl qw(:DEFAULT); use 5.010; use HTML::Entities; my $enti = HTML::Entities::encode_entities("was muss hier rein?"); say "Ergebnis: $enti";
1 2 3
$subject = =?UTF-8?Q?=E2=9E=9C?='; $decoded_subject = Encode::decode_utf8(MIME::Words::decode_mimewords($subject)); $enti = HTML::Entities::encode_entities_numeric($decoded_subject);
1 2 3 4 5
my $bytes = "\x{279c}"; use HTML::Entities; my $enti = HTML::Entities::encode_entities_numeric($bytes); say "Ergebnis: $enti";