The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
use Test::More qw(no_plan);
use Unicode::Normalize;
use strict;
use warnings;

sub entityize {
	my $stuff = NFC(shift());
	$stuff =~ s/([\x{0080}-\x{fffd}])/sprintf('&#x%X;',ord($1))/sgoe;
	return $stuff;
}

use MARC::Charset qw(marc8_to_utf8 utf8_to_marc8);
is( entityize(marc8_to_utf8('fotografâias')), 'fotografías' , 'marc8_to_utf8');