use 5.024; use autodie; use Encode qw( decode encode ); use HTML::Entities; use URI::Escape; open (my $fh,'<','t.txt'); my $content; { local $/ = undef; $content = <$fh>; } $content = decode('UTF-8',$content,Encode::FB_CROAK); $content = decode_entities($content); my @terms = ( "\N{LATIN SMALL LETTER A WITH DIAERESIS}", "\x{e4}", chr 228, decode('UTF-8',"\xc3\xa4"), decode('UTF-8',uri_unescape("%c3%a4")), ); for my $term (@terms) { my $for_terminal = encode('UTF-8',$term); while ($content =~ /$term/g) { say "Treffer: '$for_terminal' an Position " . pos $content; } }