TIMTOWTDI. Mir gefällt das dritte am besten, weil es außer ISO-8859-1 noch viele andere Legacykodierungen erkennt.
⓵
use Devel::Peek qw(Dump);
use Encoding::FixLatin qw(fix_latin);
use URI::Escape qw(uri_unescape);
while (defined (my $u = <DATA>)) {
chomp $u;
$u = uri_unescape $u;
$u = fix_latin $u;
Dump $u;
}
__DATA__
%C3%B6ffnen
%F6ffnen
⓶
use Devel::Peek qw(Dump);
use Encode qw(decode);
use Try::Tiny qw(try catch);
use URI::Escape qw(uri_unescape);
while (defined (my $u = <DATA>)) {
chomp $u;
$u = uri_unescape $u;
try {
$u = decode 'UTF-8', $u, Encode::FB_CROAK;
} catch {
$u = decode 'ISO-8859-1', $u, Encode::FB_CROAK;
};
Dump $u;
}
__DATA__
%C3%B6ffnen
%F6ffnen
⓷
use Devel::Peek qw(Dump);
use Encode qw(decode);
use Encode::Detect qw();
use URI::Escape qw(uri_unescape);
while (defined (my $u = <DATA>)) {
chomp $u;
$u = uri_unescape $u;
$u = decode 'Detect', $u;
Dump $u;
}
__DATA__
%C3%B6ffnen
%F6ffnen