Character Semantics for Built-in Functions 

my $data = "Euro \x{20AC}";

$data =~ s/([^\x00-\x7F])/'&#' . ord($1) . ';'/ge;

print $data, "\n";
Euro €